Browsing the database

Source: Internet
Author: User
Tags execution filegroup


6.3.1 Browse the database with Enterprise Manager
SQL Server provides a way of browsing the directory tree, making it easy and quick to browse database information. Click the database folder you want to browse in Enterprise Manager to see the basic information (general), table and index information (tables & Indexes) of the database in the Task Pad window on the right, The configuration of the database file (space allocated) is shown in Figure 6-8. After you open the database folder tree, you can select various database objects for information browsing.

6.3.2 Display database information with system stored procedures
SQL Server Provides many useful system stored procedures that you can use to get a lot of information that is not easy or visible from the Enterprisemanager interface (see the "Stored Procedures" section for a detailed description of stored procedures.) It doesn't matter if the reader doesn't understand the stored procedure at the moment, it can be used as a function or a command.
(1) display the database structure with system stored procedures
You can use system-supplied system stored procedure sp_helpdb to display the database structure.
Its syntax is as follows:
sp_helpdb [[@dbname =] ' name '
uses sp_helpdb system stored procedures to display information about the specified database. If you do not specify a [@dbname =]
' name ' clause, all database information stored in the Master.dbo.sysdatabases table is displayed. command to
work will return 0, otherwise return 1.
Example 6-4: Displays information about the MyDB database that was created in the previous section.
Exec sp_helpdb mydb



(2) Displaying file information with system stored procedures
You can use system-supplied system stored procedure sp_helpfile to display file information in the current database. The syntax is as follows:
Sp_helpfile [[@filename =] ' name '] If you do not specify a file name, all file information in the current database is displayed. Successful execution of the command returns 0, otherwise it returns 1.
Example 6-5: Displays information about the Mydb_data1 file in the MyDB database.
Use mydb
exec sp_helpfile mydb_data1



(3) Display filegroup information with system stored procedures
You can use system-supplied system stored procedure sp_helpfilegroup to display filegroup information in the current database. The syntax is as follows:
Sp_helpfilegroup [[@filegroupname =] ' name '
If you do not specify a filegroup name, all filegroups in the current database are displayed. Successful execution of the command returns 0, otherwise it returns 1.
Example 6-6: Displays information about the DATA2 filegroup in the MyDB database.
Use mydb
exec sp_helpfilegroup data2







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.