Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Delete Data or Log Files from a Database

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

This topic describes how to delete data or log files in SQL Server 2016 by using SQL Server Management Studio or Transact-SQL.

In This Topic


  • A file must be empty before it can be deleted. For more information, see Shrink a File.



Requires ALTER permission on the database.

Arrow icon used with Back to Top link [Top]

To delete data or log files from a database

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

  2. Expand Databases, right-click the database from which to delete the file, and then click Properties.

  3. Select the Files page.

  4. In the Database files grid, select the file to delete and then click Remove.

  5. Click OK.

Arrow icon used with Back to Top link [Top]

To delete data or log files from a database

  1. Connect to the Database Engine.

  2. From the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute. This example removes the file test1dat4.

USE master;
ALTER DATABASE AdventureWorks2012
REMOVE FILE test1dat4;

For more examples, see ALTER DATABASE File and Filegroup Options (Transact-SQL).

Arrow icon used with Back to Top link [Top]

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft