Be Careful How You Name SQL Server Stored Procedures

When creating stored procedures in a database other then the Master database, avoid using the ‘sp_’ prefix. System stored procedures are the only ones that should use the ‘sp_’ prefix. The issue is not that naming a procedure in this manner causes errors executing the procedure, but rather it slows down execution. When a procedure is named ‘sp_’, SQL server first looks in the Master database to resolve where the procedure is located. If it is not in the Master database, execution time is wasted attempting to look it up. SQL Server then looks up the stored procedure name as if the object owner is ‘dbo’. If the procedure is in the current working database, then it is executed.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: