SQL Server system tables with some properties

Source: Internet
Author: User

System tables: User-defined tables operate on the data they populate. For SQL Server, the user-defined table is equivalent to the data populated by the system tables, so the system table is used to manipulate the user database.
Data tables, stored procedures, and so on. system tables manipulate user-defined tables, and user-defined tables manipulate data from outside.

1,sysobjects table: Everything is object, this is a System object table. Tables, stored procedures, and triggers are objects that exist within this table. This table holds the creation date of the object, such as Crdate.
Find a user table: SELECT *?? From sysobjects where xtype = ' U ' and status >0
??????? Because dtproperties is a system table, but the type is ' U ', but the status is negative, it should be removed when the user table is pure. Dtproperties This table holds the diagram.
Check the stored procedure: SELECT *?? From sysobjects where xtype = ' P '
Note: The type is available in SQL Server 6.0, xtype only appears in SQL Server 7.0, and the type is reserved for backwards compatibility only.
?????
?????? Correlation function: object_id (' mytable '), identifying the ID value of the object name in the sysobjects table
??????????????????????? OBJECT_ID (object_id), according to ID object name isolated

2,sys.servers View all local servers and linked servers select * from Master. sysservers The table is stored only in the master database.

3,sys.databases queries all databases created by non-SAS select * from Master. sysdatabases The table is stored only in the master database.

4, Sys.columns gets all the fields of the table or view, all parameters of the stored procedure or function select name from syscolumns where id=object_id (' Table name ')

5,sys.indexes each index in the database.

6, Sys.logins? Each login account occupies a row in the table.

7,?? Sys.processes database process information, stored only in the master database.
?? View User process information Select spid,uid,syslogins.name,login_time,net_address from Sysprocesses,syslogins where sys.processes.sid= Syslogins.sid

8,sysdepends? View the views, stored procedures, and functions associated with a table? SELECT * from sysdepends where depid=object_id (' Table name ')

9,sysmessages the internal errors returned by SQL Server are here and can be modified on their own, displaying the information that they indicate when an error occurs.

10,sysfiles Save the current database file size, path and other information.

11,information_schema each CHECK constraint in the current database occupies a row in the view. The Information Schema View returns information about the object to which the current user has permissions.
?????? Query which fields of a table are not allowed to be empty
??????????? Select column_name from INFORMATION_SCHEMA. COLUMNS where is_nullable= ' NO ' and table_name= ' Bdorder '

SQL Server system tables with some properties

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.