Hello.
I am experiencing problems with the script below. The Error message reads:
"Executing the query "Declare @SQL3 VarChar(500)
SELECT @SQL3 = 'USE ' ..." failed with the following error: "Must declare the scalar variable "@db1".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."
I would very much appreciate help and assistance to get this running. Thank you so much.
DECLARE @db1 varchar(20)
Declare @SQL3 VarChar(500)
SELECT @SQL3 = 'USE ' + @db1
Exec (@SQL3)
Go
Exec sys.sp_cdc_disable_db;
Go
Declare @SQL4 VarChar(500)
SELECT @SQL4 = 'DBCC SHRINKDATABASE(' + @db1 + ', 5, TRUNCATEONLY)'
Exec (@SQL4)
GO