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
Pros and Cons of Prop Trading FX | Pepperstone
Customer identity verification 101 | Stripe
Live2.Dentrixascend.com
Amwednesday Vimeo
Bm1 Bus Tracker
Okta Nhrmc
Finn Wolfhard Updates
Revit Forums
South Bend Weather Underground
Hca Gulf Coast Scheduler
Encore Atlanta Cheer Competition
Stretch limos were the ultimate status symbol. Now they're going for cheap on Craigslist.
Graphic Look Inside Jeffrey
Cognitive Function Test Potomac Falls
XFN: Introduction and Examples
Wisconsin Volleyball Team Boobs Uncensored
The Creator Showtimes Near Baxter Avenue Theatres
Scat Ladyboy
Apartments For Rent Seattle Wa Craigslist
Th 8 Best Army
Laveen Modern Dentistry And Orthodontics Laveen Village Az
Moneykey Loan Login
Djs In The 90S
The Boogeyman Showtimes Near Century 20 Daly City And Xd
Www.stantonoptical/Order-Status
Used Gooseneck Trailers For Sale On Craigslist
Complications of Tattoos and Tattoo Removal: Stop and Think Before you ink - JCAS
(6302Z) Rillenkugellager einreihig 2Z Deckscheibe beidseitig, Außen-Ø 42mm, Innen-Ø 15mm, Breite 13mm von NTN
Txfbins
Harvestella Sprinkler Lvl 2
The Philadelphia Inquirer from Philadelphia, Pennsylvania
Interval Training Weegy
Bolivar Street Boutique
Defender Control v2.1
Chickasaw Garbage And Sewer
Parent Portal Pat Med
This Modern World Daily Kos
Premier Solto Hotel by Corendon (Cesme)
Pirate Proxy List 2022
Gho Inventory Homes Vero Beach
Wv Mugshots 2023
855-539-4712
bitchinbubba face leak & bitchinbubba face reveal twitch| Discover
Why Is My Lookah Dragon Egg Blinking Yellow
About Us | Full Suite of Products, Personal Service
Aabb Investorshub
Jd Needle Art
Obituaries and Death Notices of St. Martin Parish Louisiana
Holley Gamble Funeral Home In Clinton
Latina Busty Webcam
Edible Arrangements Track
Carthage Women's Soccer Roster
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.