SQL Server system stored procedures are also good hundreds of, forget it, or write a few commonly used.
1, sp_help Inquiry form Information
To execute a stored procedure:
sp_help person
The results appear as follows:
Mom a B, with this picture, you still do not know how to look at a table with that information, the elder brother will not learn SQL Server. In addition, there are constraints, stored procedures, custom functions and other information, later supplemented.
2. sp_helpdb View database Information
To execute a stored procedure:
sp_helpdb Testdatacenter
The results appear as follows:
Of course, you can also display all database information under the current database connection without parameters.
This diagram contains almost all the information about the database. With this picture, it's easy to know the information about a database.
3. Sp_helpindex View information about indexes on a table or view
To execute a stored procedure:
Sp_helpindex person
Note that the table name is in the parameter, and the person above is the table name, not the index name.
The results appear as follows:
4, sp_helpconstraint view the constraint information on the table
To execute a stored procedure:
Sp_helpconstraint person
Note that the parameter is the table name.
The results appear as follows:
5, Sp_helpfile according to the file logical name, view the file information
To execute a stored procedure:
Sp_helpfile Testdatacenter
Note The parameter is the logical name of the file. You can also output all the file information for the current database without parameters.
The results appear as follows:
6. Sp_helpfilegroup View filegroup Information According to the file group name
To execute a stored procedure:
'PRIMARY'
The parameter name is the logical name of the filegroup, and of course it can be taken without parameters, so that only the filegroup information for the current database is output.
The results appear as follows:
7. sp_helptext displays the definitions of default values, unencrypted Transact-SQL stored procedures, user-defined Transact-SQL functions, triggers, computed columns, CHECK-constraint lights, and so on.
To execute a stored procedure:
Sp_helptext spname
The results appear as follows:
What is the return? is the defined code.
SQL Server System stored procedures