sp_MSforeachdb用法 (遍历数据库)

DECLARE @command varchar(1000)
SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'') BEGIN USE ? EXEC(''select * from sys.database_files'') END'
EXEC sp_MSforeachdb @command

你可能感兴趣的:(数据库,command)