SQL Server T

Source: Internet
Author: User
Welcome to the Windows community forum and interact with 3 million technical staff. How can I use the SQL command "T" to query tables in a database to facilitate table operations, for more information, see 1. query all the tables in SQL: SelectTABLE_NAMEFROM database name. INFORMATION_SCHEMA.TABLESWhereTABLE _

Welcome to the Windows community forum, and interact with 3 million technical staff> go to SQLServer and use the T-SQL command to query tables in a database for table operations, for more information, see 1. query all tables in SQL: Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE _

Welcome to the Windows community forum and interact with 3 million technicians>

How can SQL server use the T-SQL command to query tables in a database for convenient table operations? For more information, see

1. query all tables in SQL:

Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE_TYPE = 'base table' after execution, you can see the names of all tables created by yourself in the database.

2. query all tables and columns in SQL:

Select dbo. sysobjects. name as Table_name, dbo. syscolumns. name AS Column_name FROM dbo. syscolumns inner join dbo. sysobjects ON dbo. syscolumns. id = dbo. sysobjects. id Where (dbo. sysobjects. xtype = 'U') AND (NOT (dbo. sysobjects. name LIKE 'dtproperties '))

3. There is also a simple query method in the SQL query Analyzer:

EXEC sp_MSforeachtable @ command1 = "sp_spaceused '? '"After execution, you can see information about all user tables in the database.

4. query the total number of stored procedures:

Select count (*) Total number of stored procedures from sysobjects where xtype = 'P'

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

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.