System Stored Procedures System stored procedures are packaged with SQL Server. Many procedures are used to administer SQL Server, but some are utilities that can be profitablly used by developers. They are global, and can be called from any database application without their fully qualified name. (They are all owned by dbo.) . They are all stored in the Master database, and have the prefix sp_. This is a reason why it is considered unwise to name local stored procedures with the sp_ prefix. They can be read by viewing their properties in the Query Analyzer.
The system-stored procedures are grouped into these categories.
You can create your own system-stored procedures by following the guidelines outlined above. But, even though it is possible to modify an existing system sproc, it is better to name it with another name than to destroy the system version.
Dynamic Queries are created and executed within a stored procedure, and are built typically by passing in text parameters and creating a text SQL string. Then the string is executed using the form EXEC (@createdstring). Dynamic query plans are not stored in cache, and local variables created in the dynamic query are not available after the query is executed. To save the query plan, instead of the keyword EXEC, use sp_executesql. Also, with sp_executesql local variables can be used both as INPUT and as OUTPUT parameters.
Autoexec procedures, called autostart procedures can be made by invoking the system stored procedure
Extended Store Procedures
Extended stored procedures are auxiliary stored procedures created in a DLL using C++. They are prefixed with xp_, and stored in the Master database. When called from an application database, they bust be fully referenced, using the Master..xp_procname form. Before you can invoke it, you must register the DLL with SQL Server using the syntax:
sp_addextendedproc [@functname=] ‘procedure’, [@dllname=] ‘dll’
This resource discusses Sybase database management system.
This resource gives insightful information on accessing stored procedures.
Metro NY / NJ SQL Server Consultants
We specialize is custom database software. Call us for a free consultation (973) 635 0080
Computer Consultants: Database Development