Sqlserver queries the number of tables in the database.
Sqlserver query the number of tables in the database <div class = "articalTitle" style = "clear: both; line-height: 20px; padding-bottom: 10px;>
SELECT * FROM sysobjects WHERE (xtype = 'U ')
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
View the table structure:
Use databasename;
Sp_help 'table name'; // use quotation marks.
How can I query tables in the database in SQL server?
Select name from sysobjects
How does SQLServer use T-SQL commands to query tables in a database?
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 the SQL statement: 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. Score in SQL query Parser, there is a simple query method: EXEC sp_MSforeachtable @ command1 = "sp_spaceused '? '"After execution, you can see information about all user tables in the database. 4. Total number of stored procedures queried: select count (*) total number of stored procedures from sysobjects where xtype = 'P' attachment: xtype type D = DEFAULT value or DEFAULT constraint F = foreign key constraint L = Log FN = scalar function IF = nested table function P = stored procedure WHERE (xtype = 'U ') the sysobjects table of the database contains information about all the tables of the database. The xtype value is 'U', which indicates the table name. Note: Generally, you can obtain a dtproperties table for all users by using the preceding method, SQLSERVER by default, it is also a user table. To discharge data from a user table, you must add the condition status> 0, that is, select * from sysobjects where xtype = 'U' and status> 0.