Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put stored proc
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00704050
Message ID:
00705185
Vues:
10
You can put the stored procedure in the master database and prefix the name with sp_. When you want to execute it, do so from the database of interest. Since the proc's name begins with sp_, SQL Server will first look in the master database. Finding it there, SQL Server will execute it in the context of your database.

-Mike

>I have several databases on my server that have the same structure. I have a stored procedure that I want to run periodically on each database. Instead of copying the same sp to each database, I could add it to master. If I do that, how do I tell it which database tables I want to reference? I get 'invalid object name' because it looks like it switches to the master database to run the sp. Tell me if I am not making sense.
>
>TIA
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform