代码改变世界

Review the syntax of using sp_MsForEachDb

2010-03-19 09:33  superbullet  阅读(197)  评论(0)    收藏  举报
Review the syntax of using sp_MsForEachDb

EXEC sp_MsForEachDb @command1 = 

'
 IF CHARINDEX(''ul_'', ''?'') > 0 
    BEGIN
USE [?]; 
DELETE FROM xero_Config 
DECLARE @totalRow INT
SELECT @totalRow = COUNT(*) FROM aTable
PRINT ''?'' + '': '' + CAST(@totalRow AS NVARCHAR(MAX))
    END
'