Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

store procedure naming

Status
Not open for further replies.

ghobbes98

Programmer
Feb 7, 2002
62
IE
I think I remember reading somewhere that it is best not to name a store procedure with a sp_ prefix but I cannot remember the reason why. Something to do with where the computer starts looking for where the store procedure is.
Anybody know the proper reason?
Thanks
G
 
If u use the sp prefix, SQL Server will first look for the stored procedure in the master database instead of the current one when it is executed. Obviously, this which wastes time.
 
If the stored procedure is prefixed with sp and you don't specify the database in the execute command the server will first search the master database. If it's not found there it will then search your current connection database.

I would say it's good practice to have all user databases SP's prefixed with something different and adopt that as your site standard.

Rick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top