MSDN

System Stored Procedures

This section provides reference information for the Transact-SQL (T-SQL) system stored procedures that are available in SQL Server.

Overview

System stored procedures are built-in stored procedures provided by SQL Server that perform various administrative and maintenance tasks. They are identified by the sp_ prefix.

Categories of System Stored Procedures

System stored procedures can be broadly categorized as follows:

Commonly Used System Stored Procedures

sp_configure

Allows you to view and change server-level configuration options.

-- View all configuration options
EXEC sp_configure;

-- Change the 'max server memory (MB)' option
EXEC sp_configure 'max server memory (MB)', 2048;
RECONFIGURE;
GO

sp_who2

Provides information about the current users and processes on an instance of SQL Server.

EXEC sp_who2;

-- Get information about a specific SPID (Server Process ID)
EXEC sp_who2 55;

sp_help

Returns information about a database object, such as a table, view, or stored procedure.

EXEC sp_help 'YourTableName';

sp_databases

Lists all databases on the SQL Server instance.

EXEC sp_databases;

Finding Specific System Stored Procedures

You can query the sys.procedures catalog view to list all stored procedures, including system stored procedures.

SELECT name
FROM sys.procedures
WHERE is_ms_shipped = 1
ORDER BY name;

For detailed syntax, parameters, and usage examples for each system stored procedure, please refer to the specific documentation for your version of SQL Server.

Important Considerations