June 2, 2004 at 8:38 am
I noticed that when I was in Query Analyzer, I could call SPs from other database (e.g. SP_HELP which I think is in Master). Can I create my own Database (say Utility) and store all my Utility SPs in that database and call it from other database? How ?
June 2, 2004 at 3:05 pm
Yes.
You just need to qualify the name of the procedure...
exec UtilityDB.dbo.My_Stored_Proc
By the way, sp_help can be run from any database without being qualified because it is stored in the master database and the first 3 characters of its name are 'sp_' . There may be situations in which you will want this functionality in your utility procedures. In that case, name it sp_... and put it in master.
I make it a rule NOT to name my utility procedures "sp_..." to avoid confusion. I name mine "af_.." (its an abbreviation of the company name). If I want to name it "sp_..." in the master database, then I tack on the 'af_' after the "sp_". Just makes it easier to differentiate my procs from Microsoft's.
Steve
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply