Created
April 22, 2020 07:15
-
-
Save tknaller/bcf50dfe25f2ac30b65ee991d93e0246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
'USE [' + d.name + N']' + CHAR(13) + CHAR(10) | |
+ 'DBCC SHRINKFILE (N''' + mf.name + N''' , 0, TRUNCATEONLY)' | |
+ CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10) | |
FROM | |
sys.master_files mf | |
JOIN sys.databases d | |
ON mf.database_id = d.database_id | |
WHERE d.database_id > 4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment