System stored procedures (Transact-SQL)
Applies to: SQL Server 2016 (13.x) and later Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics SQL analytics endpoint in Microsoft Fabric Warehouse in Microsoft Fabric
In SQL Server, many administrative and informational activities can be performed by using system stored procedures. The system stored procedures are grouped into the categories shown in the following table.
In this section
Category | Description |
---|---|
Active Geo-Replication stored procedures | Used to manage Active Geo-Replication configurations in Azure SQL Database |
Catalog stored procedures | Used to implement ODBC data dictionary functions and isolate ODBC applications from changes to underlying system tables. |
Change Data Capture stored procedures | Used to enable, disable, or report on change data capture objects. |
Cursor stored procedures | Used to implements cursor variable functionality. |
Data collector stored procedures | Used to work with the data collector and the following components: collection sets, collection items, and collection types. |
Database Engine stored procedures | Used for general maintenance of the SQL Server Database Engine. |
Database Mail stored procedures | Used to perform e-mail operations from within an instance of SQL Server. |
Database Maintenance Plan stored procedures | Used to set up core maintenance tasks that are required to manage database performance. |
Distributed Queries stored procedures | Used to implement and manage distributed queries. |
FILESTREAM and FileTable stored procedures | Used to configure and manage the FILESTREAM and FileTable features. |
Firewall Rules stored procedures (Azure SQL Database) | Used to configure the Azure SQL Database firewall. |
Full-Text Search and Semantic Search stored procedures | Used to implement and query full-text indexes. |
General extended stored procedures | Used to provide an interface from an instance of SQL Server to external programs for various maintenance activities. |
Log Shipping stored procedures | Used to configure, modify, and monitor log shipping configurations. |
Management Data Warehouse stored procedures | Used to configure the management data warehouse. |
MSDTC stored procedures | Use for resetting the Microsoft Distributed Transaction Coordinator (MSDTC) log or looking at MSDTC statistics. |
OLE Automation stored procedures | Used to enable standard Automation objects for use within a standard Transact-SQL batch. |
Policy-Based Management stored procedures | Used for Policy-Based Management. |
PolyBase stored procedures | Add or remove a computer from a PolyBase scale-out group. |
Query Store stored procedures | Used to tune performance. |
Replication stored procedures | Used to manage replication. |
Security stored procedures | Used to manage security. |
Snapshot Backup stored procedures | Used to delete the FILE_SNAPSHOT backup along with all of its snapshots or to delete an individual backup file snapshot. |
Spatial Index stored procedures | Used to analyze and improve the indexing performance of spatial indexes. |
SQL Server Agent stored procedures | Used by SQL Server Profiler to monitor performance and activity. |
SQL Server Profiler stored procedures | Used by SQL Server Agent to manage scheduled and event-driven activities. |
Spatial index stored procedures - arguments and properties | Use for spacial indexes. |
XML stored procedures | Used for XML text management. |
Note
Unless specifically documented otherwise, all system stored procedures return a value of 0
to indicate success. To indicate failure, a nonzero value is returned.
API system stored procedures
Users that run SQL Server Profiler against ADO, OLE DB, and ODBC applications might notice these applications using system stored procedures that aren't covered in the Transact-SQL Reference. These stored procedures are used by the SQL Server Native Client OLE DB Provider and the SQL Server Native Client ODBC driver to implement the functionality of a database API. These stored procedures are just the mechanism the provider or driver uses to communicate user requests to an instance of SQL Server. They are intended only for the internal use of the provider or the driver. Calling them explicitly from a SQL Server-based application isn't supported.
The sp_createorphan
and sp_droporphans
stored procedures are used for ODBC ntext, text, and image processing.
The sp_reset_connection
stored procedure is used by SQL Server to support remote stored procedure calls in a transaction. This stored procedure also causes Audit Login and Audit Logout events to fire when a connection is reused from a connection pool.
The system stored procedures in the following tables are used only within an instance of SQL Server or through client APIs and aren't intended for general customer use. They are subject to change and compatibility isn't guaranteed.
The following stored procedures are documented:
The following stored procedures aren't documented:
sp_assemblies_rowset
sp_assemblies_rowset_rmt
sp_assemblies_rowset2
sp_assembly_dependencies_rowset
sp_assembly_dependencies_rowset_rmt
sp_assembly_dependencies_rowset2
sp_bcp_dbcmptlevel
sp_catalogs_rowset
sp_catalogs_rowset;2
sp_catalogs_rowset;5
sp_catalogs_rowset_rmt
sp_catalogs_rowset2
sp_check_constbytable_rowset
sp_check_constbytable_rowset;2
sp_check_constbytable_rowset2
sp_check_constraints_rowset
sp_check_constraints_rowset;2
sp_check_constraints_rowset2
sp_column_privileges_rowset
sp_column_privileges_rowset;2
sp_column_privileges_rowset;5
sp_column_privileges_rowset_rmt
sp_column_privileges_rowset2
sp_columns_90
sp_columns_90_rowset
sp_columns_90_rowset_rmt
sp_columns_90_rowset2
sp_columns_ex_90
sp_columns_rowset
sp_columns_rowset;2
sp_columns_rowset;5
sp_columns_rowset_rmt
sp_columns_rowset2
sp_constr_col_usage_rowset
sp_datatype_info_90
sp_ddopen;1
sp_ddopen;10
sp_ddopen;11
sp_ddopen;12
sp_ddopen;13
sp_ddopen;2
sp_ddopen;3
sp_ddopen;4
sp_ddopen;5
sp_ddopen;6
sp_ddopen;7
sp_ddopen;8
sp_ddopen;9
sp_foreign_keys_rowset
sp_foreign_keys_rowset;2
sp_foreign_keys_rowset;3
sp_foreign_keys_rowset;5
sp_foreign_keys_rowset_rmt
sp_foreign_keys_rowset2
sp_foreign_keys_rowset3
sp_indexes_90_rowset
sp_indexes_90_rowset_rmt
sp_indexes_90_rowset2
sp_indexes_rowset
sp_indexes_rowset;2
sp_indexes_rowset;5
sp_indexes_rowset_rmt
sp_indexes_rowset2
sp_linkedservers_rowset
sp_linkedservers_rowset;2
sp_linkedservers_rowset2
sp_oledb_database
sp_oledb_defdb
sp_oledb_deflang
sp_oledb_language
sp_oledb_ro_usrname
sp_primary_keys_rowset
sp_primary_keys_rowset;2
sp_primary_keys_rowset;3
sp_primary_keys_rowset;5
sp_primary_keys_rowset_rmt
sp_primary_keys_rowset2
sp_procedure_params_90_rowset
sp_procedure_params_90_rowset2
sp_procedure_params_rowset
sp_procedure_params_rowset;2
sp_procedure_params_rowset2
sp_procedures_rowset
sp_procedures_rowset;2
sp_procedures_rowset2
sp_provider_types_90_rowset
sp_provider_types_rowset
sp_schemata_rowset
sp_schemata_rowset;3
sp_special_columns_90
sp_sproc_columns_90
sp_statistics_rowset
sp_statistics_rowset;2
sp_statistics_rowset2
sp_stored_procedures
sp_table_constraints_rowset
sp_table_constraints_rowset;2
sp_table_constraints_rowset2
sp_table_privileges_rowset
sp_table_privileges_rowset;2
sp_table_privileges_rowset;5
sp_table_privileges_rowset_rmt
sp_table_privileges_rowset2
sp_table_statistics_rowset
sp_table_statistics_rowset;2
sp_table_statistics2_rowset
sp_tablecollations
sp_tablecollations_90
sp_tables_info_90_rowset
sp_tables_info_90_rowset_64
sp_tables_info_90_rowset2
sp_tables_info_90_rowset2_64
sp_tables_info_rowset
sp_tables_info_rowset;2
sp_tables_info_rowset_64
sp_tables_info_rowset_64;2
sp_tables_info_rowset2
sp_tables_info_rowset2_64
sp_tables_rowset;2
sp_tables_rowset;5
sp_tables_rowset_rmt
sp_tables_rowset2
sp_usertypes_rowset
sp_usertypes_rowset_rmt
sp_usertypes_rowset2
sp_views_rowset
sp_views_rowset2
sp_xml_schema_rowset
sp_xml_schema_rowset2