SQL Server System stored procedures

Source: Internet
Author: User
Tags filegroup

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.