Stored Procedure Naming Conventions

No Comments

Any development shop you go to, there are coding naming conventions.  Well, at least there should be. These can very from place to place, but one naming convention I’ve seen in pretty much every place I’ve worked has been the use of “sp_” as a prefix for MS SQL stored procedures.

I guess it makes sense, sp – stands for stored procedure. Well, guess what, if you are naming your sprocs with this prefix, you sir, are doing it wrong.  I have had developers argue with me until they are blue in the face, that the only “proper” way of naming a sproc is to start it with sp_

Anyway, for any of you non believers out there, here is the word, straight from MS:

Don’t Use the sp_ prefix

The sp_ prefix is reserved for system stored procedures. The database engine will always look for stored procedures with this prefix first in the master database. This means that it will take just a bit longer to finish processing while the engine looks through the master database first, and then the database where the stored procedure actually resides. Also, if there happens to be a system stored procedure with an identical name, your procedure won’t get processed at all.

Source: http://msdn.microsoft.com/en-us/library/ms973918.aspx

 

Well there you have it. Go forth and code.

Newer Entries