赞
踩
查询表接口与视图结构
SELECT
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH
FROM
information_schema.COLUMNS
WHERE
TABLE_NAME = '表名/视图名'
下面这个没法查询视图结构:
SELECT obj.name ,
col.name AS column_name ,
t.name AS data_type ,
col.length AS length
FROM dbo.syscolumns col
LEFT JOIN dbo.systypes t ON col.xtype = t.xusertype
inner JOIN dbo.sysobjects obj ON col.id = obj.id
AND obj.xtype = 'U'
AND obj.status >= 0
WHERE obj.name = '表名'
ORDER BY obj.name ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。