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

  • @ninja's_RGR'us: I really like that solution and have already been putting it to use, but I'm trying to make one slight modification and am having some difficulties. Hopefully someone can help me out here.

    What I'd like to do is use that same solution but find a way to have it detect all linked servers and run the same thing on all the linked servers as well. Unfortunately when using these stored procedures, any variables passed in are only good for the duration of the procedure and we can't pass a variable for the linked server name unless we declare and define it within the same variable that we are passing to sp_MSforeachdb (@Cmd in this case). I know this is do-able but I'm having trouble doing it properly. Any help would be much appreciated.

    Thanks!

    -jared