Click here to Skip to main content
12,690,140 members (32,392 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

8K views
1 bookmarked
Posted

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.

Code


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[^]

Acknowledgments


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

License

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

Share

About the Author

thatraja
Web Developer
India India
Retired from Q/A section & Technical forums since 2014

More coming soon....

You may also be interested in...

Comments and Discussions

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