Method 1: Using SQL Server Management Studio

Follow the steps to shrink or reduce the SQL Server database size (.MDF and .LDF).

Step 1: Right-click on the database name >> Tasks >> Shrink >> Database.

Step 2: Then Click OK.

Method 2: Using Transact SQL Command

Follow the steps to shrink or reduce the SQL Server database size using SQL command.

Step 1: Open SQL Server Management Studio.

Step 2: Connect to the Database Engine.

Step 3: From the Standard bar, click New Query.

Step 4: Type the following SQL command into the query window and click Execute.

DBCC SHRINKDATABASE (DatabaseName, ‘target percent’) — This command shrinks the test database

Example:

DBCC SHRINKDATABASE (test, 10);

GO

Now you have shrunk the database size successfully!

Tagged: