触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > SQL取得数据库中各个表的属性

取得数据库中各个表的表名
select name from sysobjects where type='U'

取得数据库中各个表的表名里的字段类型
select name from syscolumns where id=object_id('表')


获取表的结构(字段,属性,长度)
SELECT syscolumns.name,systypes.name,syscolumns.isnullable,
syscolumns.length
FROM syscolumns, systypes
WHERE syscolumns.xusertype = systypes.xusertype
AND syscolumns.id = object_id('你的表名')

***获取表的结构(字段,字段说明)
select name, (select value from sysproperties where id = syscolumns.id and smallid=syscolumns.colid) as 描述 from syscolumns where id=object_id('你的表名')

***字段名、长度、类型
select column_name,data_type,isnull(isnull(isnull(character_maximum_length,numeric_precision),datetime_precision),1) length from information_schema.columns
where table_name = 'DUTYTIME'


表名、字段名、长度、类型。。。
select
 table_name ,
 column_name,
 isnull(column_default,'') default_value,
 is_nullable,
 data_type,
 isnull(isnull(isnull(character_maximum_length,numeric_precision),datetime_precision),1) length
from information_schema.columns
where table_name = 'DUTYTIME'

*****
获取表的结构(字段,属性,长度,说明)
SELECT syscolumns.name,systypes.name,syscolumns.isnullable,
syscolumns.length, (select value from sysproperties where id = syscolumns.id and smallid=syscolumns.colid) as 描述
FROM syscolumns, systypes
WHERE syscolumns.xusertype = systypes.xusertype
AND syscolumns.id = object_id('DUTYTIME')

 


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com