Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SPROC Naming Convention

Author  Topic 

ackweb
Yak Posting Veteran

54 Posts

Posted - 2005-01-22 : 00:30:43
I've read several places recently, that you shouldn't prefix your SPROCs with "sp_" because this naming convention is associated with the master database: http://www.databasejournal.com/features/mssql/article.php/1565961

Prior to reading these articles, I'd gotten in the habit of prefixing my SPROCs with just "sp" and wanted to confirm that this avoids the problems associated with the "sp_" prefix. I'd appreciate feedback on my use of "sp" and/or whether there are better naming conventions that I should adopt. Thanks!

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-01-22 : 01:09:05
The "sp_" prefix has an deleterious and unnecessary effect on performance of the sproc. "sp" by itself avoids this.


As to a proper naming convention, you have opened a can of worms.

The use prefixes, in general, is considered a bad idea. Why do you need the prefix to let you know that the stored procedure that you are executing is a stored procedure. There is some research material to indicate that the presence of the prefix hinders the efficiency of the coding process. Not the execution eficiency, but the ability of the programmer to assimilate the object name.

You might want to get a copy of a book called "Code Complete". It talks, at length, about naming and related concepts.

HTH

=================================================================

Our elections are free, it's in the results where eventually we pay. -Bill Stern, sports announcer (1907-1971)
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2005-01-24 : 03:57:41
quote:
The "sp_" prefix has an deleterious and unnecessary effect on performance of the sproc.


This is absolutely correct, the reason being that SQL Server will look through the system sprocs first - so presumably the same applies for "xp_"

Perhaps someone could enlighten us


steve


And how is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-01-24 : 08:41:17
No, it does not do the same thing for an xp_ prefix. You can test that by calling an xp_ procedure from another database without including "master" in the procedure name.

Still, I would avoid prefixing regular stored procedures with "xp_".
Go to Top of Page
   

- Advertisement -