[求助]sql server 2005中的方法,如何在2000中实现?
SELECT c.column_id as fld_id, --字段ID
c.name as fld_name, --字段名称
t.name as fld_type, --字段类型
c.max_length as max_length, --类型大小
c.is_nullable, --是否为空
c.is_identity, --是否主键
e.value as fld_description, --表说明
s.text as fld_explain --字段说明
FROM sys.columns as c
INNER JOIN sys.tables as b on c.object_id=b.object_id
INNER JOIN sys.types as t on c.system_type_id=t.system_type_id
LEFT JOIN sys.extended_properties as e ON e.major_id=c.object_id AND e.minor_id=c.column_id
LEFT JOIN sys.syscomments as s ON s.id=c.default_object_id
WHERE b.name=@Name --表名
ORDER BY c.column_id
---------------------------------
各位大侠好:
以上是sql2005查询的语句,请问如何在sql2000中也可以用?
问题:有没有sql2000、sql2005都可用的方法,求在一个sql中实现以上结果又兼容2005和2000的语句。
谢谢~~~
------解决方案--------------------sys.extended_properties对应2000暂时没找到,记不清有没有
SELECT c.colid as fld_id, --字段ID
c.name as fld_name, --字段名称
t.name as fld_type, --字段类型
c.length as max_length, --类型大小
c.isnullable, --是否为空
-- c.is_identity --是否主键
-- e.value as fld_description, --表说明
s.text as fld_explain --字段说明
FROM syscolumns as c
INNER JOIN sysobjects as b on c.id=b.id and b.type = 'u'
INNER JOIN systypes as t on c.type =t.type
LEFT JOIN syscomments as