FIX: User-Defined System Stored Procedures Must Be In Master

ID: Q159901


The information in this article applies to:

BUG #: 16334 (6.5)

SYMPTOMS

There is a documentation error in the SQL Server 6.0 and 6.5 "Transact-SQL Reference." The documentation states that you can create a user-defined system stored procedure in a database other than the master database. This statement is incorrect; all user-defined system stored procedures should be created only by the system administrator (SA), and only in the master database. User-defined system stored procedures start with the prefix "sp_".

User-defined system stored procedures created in databases other than the master database may cause unexpected behavior regarding which objects are referenced. This problem is especially pronounced if multiple user-defined stored procedures with the same name exist in different databases. Due to the special name resolution rules for system stored procedures, there is no way to predict which of the two identically-named stored procedures are run.


WORKAROUND

Only the System Administrator should create user-defined system stored procedures, and these procedures should only be created in the master database.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft SQL Server versions 6.0 and 6.5 documentation. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.


MORE INFORMATION

The "Transact-SQL Reference," under the User-defined System Stored Procedures heading, states:

When executed, a stored procedure is typically found within the current database. If the procedure name begins with sp_ and is not found in the current database, SQL Server will look in the master database.

This statement incorrectly implies that you can create user-defined system stored procedures outside of the master database. The statement in Example H of the CREATE PROCEDURE Examples section is correct: "user-defined system stored procedures...must be created by the system administrator in the master database."


Keywords          : kbusage SSrvDoc_Err SSrvStProc kbbug6.50 kbbug6.00 kbfix6.50.sp2 
Version           : 6.0 6.5
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 4, 1999