Home Forums SQL Server 7,2000 T-SQL sp_MSForeachdb then sp_MSforeachtable RE: sp_MSForeachdb then sp_MSforeachtable

  • try this...

    declare @command1 varchar(8000)

    select @command1 =

    '

    IF ''@'' ''master'' AND ''@'' ''model'' AND ''@'' ''msdb'' AND ''@'' ''tempdb''

    begin

    use [@] execute sp_MSForEachTable ''print ''''?'''' ''

    end

    '

    exec sp_MSforeachdb @command1, '@'

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA