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

  • You can use whatever you like for the substitution character, but if you use something other than ? you need to specify it with a second parameter to the sp_msforeachdb or sp_msforeachtable sp with the parameter @replacechar.

    sp_helptext 'sp_msforeachdb'

    or

    sp_helptext 'sp_msforeachtable'

    However, each of the sp_msforeach stored procs creates a cursor anyway and you're stuck with the capabilities programmed into MS's undocumented SPs. By writing your own outer loop via your own cursor instead of MS's... you can slip in the database name, which you'll probably want.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]