Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gcsin
Starting Member
2 Posts |
Posted - 2008-10-01 : 02:40:25
|
| I want to shrink all database at a time using job. For this I have to write a sp. Please help me, how i can write a sp to shrink all database one by one. |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-10-01 : 14:38:00
|
| CREATE procedure SP_SHRINK_ALL_DBasbegindeclare @dbname varchar(50)DECLARE dblist_cursor CURSOR forselect name from master.dbo.sysdatabasesOPEN dblist_cursorFETCH NEXT FROM dblist_cursor INTO @dbnameWHILE @@FETCH_STATUS = 0BEGINDBCC SHRINKDATABASE(@dbname)FETCh NEXT from dblist_cursorinto @dbnameEND CLOSE dblist_cursorDEALLOCATE dblist_cursorend |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-10-01 : 15:34:31
|
| Read this for why you shouldn't shrink:http://www.karaszi.com/SQLServer/info_dont_shrink.asp |
 |
|
|
gcsin
Starting Member
2 Posts |
Posted - 2008-10-06 : 03:44:24
|
| Thanks guys |
 |
|
|
|
|
|