Creating and Dropping Stored Procedures

Stored procedures are created using the CREATE PROCEDURE statement or the equivalent statement CREATE PROC. When a stored procedure is created, its properties are stored in the sysobjects system table, and its definition (all the statements it contains) in the syscomments system table. A stored procedure is stored in the current database; therefore, if you want to create a stored procedure in other databases, you have to make the other database the current one before creating it (using the USE statement ).

After a stored procedure is created, you can view its parameters and definition using the sp_helptext system stored procedure. You can view its properties using sp_help.

In Listing 8.5, you can see an ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.