IMP Stored Procedures that Every DBA should know
This blog is the continuation of blog IMP DMVs, SPs & Functions that Every DBA should know.
In this blog, we will talk about some of the IMP and mostly used system stored procedures that every DBA should be aware of.
1) sp_helptext
Type:
Stored Procedure
Description:
This System Procedure is used to view the definition of database objects. (i.e., SPs,
Views, Triggers)
Ex:
sp_helptext 'sp_helpDB'
Parameter_name |
Type |
Length |
@objname |
nvarchar |
1552 |
@columnname |
sysname |
256 |
2) sp_helpdb
Type:
Stored Procedure
Description:
This SP returns information about specified database or all databases.
Ex:
sp_helpdb
sp_helpdb <Database_Name>
Parameter_name |
Type |
Length |
@dbname |
sysname |
256 |
3) sp_helpfile
Type:
Stored Procedure
Description:
This SP returns information about specified database file or all database
files.
Ex:
sp_helpfile
sp_helpfile <Filename>
Parameter_name |
Type |
Length |
@filename |
sysname |
256 |
4) sp_helpfilegroup
Type:
Stored Procedure
Description:
This SP returns the names and attributes of filegroups associated with the
current database.
Ex:
sp_helpfilegroup
Parameter_name |
Type |
Length |
@filegroupname |
sysname |
256 |
5) sp_helpstats
Type:
Stored Procedure
Description:
This SP Returns statistics information about columns and indexes on the specified
table.
Ex:
sp_helpstats '<Object_Name>','<Result>'
sp_helpstats 'PK__Employee__7AD04FF1CA043119','All'
sp_helpstats 'dbo.Suppliers','All'
Parameter_name |
Type |
Length |
@objname |
nvarchar |
1552 |
@results |
nvarchar |
10 |
6) sp_columns
Type:
Stored Procedure
Description:
This SP returns column information for the specified objects that can be
queried in the current environment.
Ex:
sp_columns 'Suppliers'
Parameter_name |
Type |
Length |
@table_name |
nvarchar |
768 |
@table_owner |
nvarchar |
768 |
@table_qualifier |
sysname |
256 |
@column_name |
nvarchar |
768 |
@ODBCVer |
int |
4 |
Comments
Post a Comment