Obtain the names and views of all data tables in the current database.

Source: Internet
Author: User

 

-- Query tables and views
Select * From information_schema.tables
-- Query view
Select * From information_schema.views

-- Query all tables in the database
Select * From sysobjects where xtype = 'U' and status> 0

Sp_tables
Or:
Select * From information_schema.tables
Or:
Select * From sysobjects where xtype = 'U' and status> 0

 

Sysobjects
Each object created in the database (constraints, default values, logs, rules, stored procedures, etc.) occupies one row in the table. Each temporary object occupies one row in the table only in tempdb.

Column name data type description
Name sysname object name.
Id int ID of the object.
Xtype char (2) object type. It can be one of the following object types:
C = check Constraints
D = default value or default Constraint
F = foreign key constraint
L = Log
Fn = scalar function
If = embedded table functions
P = Stored Procedure
PK = primary key constraint (type: K)
Rf = copy and filter the Stored Procedure
S = system table
TF = table functions
Tr = trigger
U = User table
Uq = unique constraint (type is K)
V = View
X = Extended Stored Procedure

User ID of the UID smallint owner object.
Info smallint is retained. For internal use only.
Status int is retained. For internal use only.
Base_schema _
Ver int is retained. For internal use only.
Replinfo int is retained. For replication.
The object ID of the parent object of parent_obj int (for example, this ID is the table ID for triggers or constraints ).
The creation date of the crdate datetime object.
Ftcatid smallint is the full-text directory identifier of all user tables registered with the full-text index. It is 0 for all user tables not registered.
Schema_ver int version number, which increases each time the schema of the table is changed.
Stats_schema _
Ver int is retained. For internal use only.
Type char (2) object type. It can be one of the following values:
C = check Constraints
D = default value or default Constraint
F = foreign key constraint
Fn = scalar function
If = embedded table functions
K = primary key or unique constraint
L = Log
P = Stored Procedure
R = rule
Rf = copy and filter the Stored Procedure
S = system table
TF = table functions
Tr = trigger
U = User table
V = View
X = Extended Stored Procedure

Userstat smallint is retained.
Sysstat smallint internal status information.
Indexdel smallint is retained.
Refdate datetime is reserved for future use.
Version int is reserved for later use.
Deltrig int is retained.
Instrig int is retained.
Updtrig int is retained.
Seltrig int is retained.
CATEGORY int is used for publishing, constraints, and identifiers.
Cache smallint is retained.

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.