Script 2 SPs and exec one of them against all user databases

  • I was trying to find a way to loop through a temp table that has all the databases that I want to compile two stored procs and execute one of them in a loop.

    I was hoping to use a while loop on the temp table and use the 'Use' database syntax, compile the 2 objects and execute one of them but that doesn't work.

    Any other suggestions? Do I have to parse it out into a cursor? Is there another way?

    Thanks Again,

    Daniel

  • Compile of the SP in different DB from a statement.

    This may be done by using of the dynamic sql statement.

    However show your existing used statement that will help to better understand of your issue.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply