I am wondering if I can get some help with the script. I have a DB with more than 550+ data files (Of course they are all different sizes). I am trying to shrink all the files down to 80%. I have the script to generate the DBCC shrink command but I am still struggling with shrinking it to certain %. Can I please get some help?[code="sql"]Drop table #TESTCREATE TABLE #TEST(SQLQUERY VARCHAR (1000))INSERT INTO #TEST SELECT 'USE [' + d.name + N']' + CHAR(13) + CHAR(10) + 'DBCC SHRINKFILE (N''' + mf.name + N''' 0)'+CHAR(13)+'GO' FROM sys.master_files mfJOIN sys.databases dON mf.database_id=d.database_idWHERE d.database_id>4 and mf.type_desc = 'ROWS'Select * from #TEST[/code]
↧