sql 语句

//查询所有用户表

 
select * FROM sysobjects WHERE type='U' ORDER BY name
 
select * from sys.tables

 

select a.name AS '字段名',b.name AS '类型',a.length AS '长度'  from syscolumns a LEFT JOIN systypes b
ON a.xtype=b.xusertype
where a.ID = OBJECT_ID('表名')

 

select [name], [id] from sysobjects where [type] = 'U';

//查询所有系统表

select [name], [id] from sysobjects where [type] = 'S';

//列出数据表中的所有字段

select * from syscolumns where ID = OBJECT_ID('S_CityList');

//查询所有用户表中的非重复字段

select distinct [name] from syscolumns

where ID in (select id from sysobjects where [type] = 'U');

原文地址:https://www.cnblogs.com/andy_tigger/p/1781484.html