SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Deploying stored procedures to all databases.


Deploying stored procedures to all databases.

Author
Message
SQLChao
SQLChao
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 235
Let me start with that I am an accidental DBA. I'm just curious how most deploy a stored procedure to multiple databases. For instance we have a server with roughly 70 databases. I have to create / alter stored procedures that exist in all 70 databases. So far I've been able to do this by using sp_msforeachdb and doing some dynamic sql. This works but is there a better way or a best practice? I've done some searching and don't see a clear answer but I'm sure this has to come up with other DBAs.
Shishir Khandekar
Shishir Khandekar
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 158
In my opinion there is no other better way. There is Central Management Server, but it will help you if you had multiple "servers" with multiple databases. If it's just one server with a lot of databases the method you are using works pretty well.

-Shishir
Grant Fritchey
Grant Fritchey
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41249 Visits: 32666
Going to all databases on a server, you have to do some type of cursor. sp_msforeachdb is a good as anything.

If you have to go to lists of specific databases, cursors are still the way to go, but I'd move the cursor into PowerShell and make the calls that way.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search