Click here to Skip to main content
Click here to Skip to main content

Tagged as

How to Shrink SQL Server database files?

, 5 Jan 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
How to Shrink SQL Server database files?
You can shrink the database file by using the following method.


DECLARE @strDatabaseName nvarchar(255)
SET @strDatabaseName = "YourDatabaseName"
DBCC SHRINKDATABASE (@strDatabaseName, 0)--Parameters are Database Name & Target %
Working in both SQL 2005 & 2008.

For Your Information

How to shrink the tempdb database in SQL Server[^]


BTW, after this comment[^], I have created this Tip/Trick. Thanks to him.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
Programmer | Dude | ||||||
About him & his blog? check out here. Currently he's updating the site, he'll return soon there with more things*.
In Codeproject, he posted a blogpost & more than couple of Tip/Tricks, hope he'll write more soon.
Favorite techs are MVC, WCF, Mobile, HTML5, CSS3, jQuery, etc.,
His hobbies are watching movies, CP, being alone, etc., But now he's working on something*.
* - SCAMP???
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150301.1 | Last Updated 5 Jan 2011
Article Copyright 2011 by thatraja
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid