How can i create a stored proc on all databases

  • Hi

    I need to create a stored procedure on all database, I know I can use msforeachDB but the procedure is quite long winded and has a number of quotes.

    I was wondering if there is another way to do this ?

  • Why don't you make use of dynamic sql and executing the sql statements in each database by using "USE".

    MJ

  • Good point

    Just then when you have loads of commas, the time & efford that it will take to write dynamic SQL, one could actually manually install it on all the databases. Is it possible to use something like Quoted identifier and msforeachDB stored proc ?

    Is it good practice to use msforeachDB stored proc ?

  • Why don't you make use of batch files and osql utility.

    MJ

  • thats a good point actually, i was just wondering whether there is a quicker way to do this programatically.

Viewing 5 posts - 1 through 4 (of 4 total)

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