Delete Data or Log Files from a Database - SQL Server (2024)

Edit

Share via

Applies to: Delete Data or Log Files from a Database - SQL Server (1) SQL Server Delete Data or Log Files from a Database - SQL Server (2) Azure SQL Managed Instance

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

In This Topic

Before You Begin

Prerequisites

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

Security

Permissions

Requires ALTER permission on the database.

Using SQL Server Management Studio

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.

Using Transact-SQL

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;GOALTER DATABASE AdventureWorks2022REMOVE FILE test1dat4;GO

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

See Also

Shrink a Database
Add Data or Log Files to a Database

Feedback

Was this page helpful?

Delete Data or Log Files from a Database - SQL Server (2024)
Top Articles
Apple iPad (10th gen) review
Artificial Features
SZA: Weinen und töten und alles dazwischen
Antisis City/Antisis City Gym
Cars & Trucks - By Owner near Kissimmee, FL - craigslist
Devon Lannigan Obituary
Decaying Brackenhide Blanket
Graveguard Set Bloodborne
Saw X | Rotten Tomatoes
Buying risk?
George The Animal Steele Gif
Void Touched Curio
Daily Voice Tarrytown
Inside the life of 17-year-old Charli D'Amelio, the most popular TikTok star in the world who now has her own TV show and clothing line
Water Trends Inferno Pool Cleaner
Pokemon Unbound Shiny Stone Location
Phoebus uses last-second touchdown to stun Salem for Class 4 football title
12 Top-Rated Things to Do in Muskegon, MI
Gazette Obituary Colorado Springs
Directions To Cvs Pharmacy
The Listings Project New York
Jayah And Kimora Phone Number
Craig Woolard Net Worth
Walgreens On Bingle And Long Point
Bidrl.com Visalia
Osrs Important Letter
Progressbook Newark
Free Tiktok Likes Compara Smm
Salemhex ticket show3
Smayperu
Stolen Touches Neva Altaj Read Online Free
EST to IST Converter - Time Zone Tool
Steven Batash Md Pc Photos
Petsmart Northridge Photos
Legit Ticket Sites - Seatgeek vs Stubhub [Fees, Customer Service, Security]
15 Best Things to Do in Roseville (CA) - The Crazy Tourist
Tryst Houston Tx
Obituaries in Hagerstown, MD | The Herald-Mail
Newsweek Wordle
Clausen's Car Wash
Vindy.com Obituaries
The power of the NFL, its data, and the shift to CTV
Sallisaw Bin Store
Silicone Spray Advance Auto
Mother Cabrini, the First American Saint of the Catholic Church
Cult Collectibles - True Crime, Cults, and Murderabilia
Sinai Sdn 2023
Terrell Buckley Net Worth
Sams La Habra Gas Price
Edict Of Force Poe
Strange World Showtimes Near Century Federal Way
ats: MODIFIED PETERBILT 389 [1.31.X] v update auf 1.48 Trucks Mod für American Truck Simulator
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5993

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.