EXEC master..sp_MSForeachDB '
USE [?]
IF ''?'' <> ''tempdb''
BEGIN DBCC
SHRINKDATABASE (''?'')
END'
GO
Scripts, Articles, Relevant for DBAs, Consultants, BI, Data Scientists and Developers
EXEC master..sp_MSForeachDB '
USE [?]
IF ''?'' <> ''tempdb''
BEGIN DBCC
SHRINKDATABASE (''?'')
END'
GO