时间:2021-07-01 10:21:17 帮助过:3人阅读
select name from sys.objects where type=‘U‘
select name from sysobjects where xtype=‘U‘
其中type或xtype值:U = 用户表 S = 系统表 V = 视图 FN = 标量函数 TF = 表函数 P = 存储过程 TR = 触发器
D = 默认值或 DEFAULT 约束 PK = PRIMARY KEY 约束 F = FOREIGN KEY 约束 UQ = UNIQUE 约束
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.VIEWS
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘Product‘
-- 视图VProduct SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘VProduct‘
select name from syscolumns where id = object_id(‘Product‘)
SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘Product‘
Sql Server系列:SQL语句查询数据库中表、视图、存储过程等组成
标签: