sqlserver2000中columns.precision问题
Create View dbo.vwSqlColumns
with encryption
as
select objects.name as ObjectName
, objects.type as ObjectType
, columns.name as ColumnName
, columns.column_id as colid
, columns.system_type_id as xtype
, columns.system_type_id as type
, (case when columns.max_length = -1 then 1073741823
when columns.system_type_id = 231 then columns.max_length/2
when columns.system_type_id = 99 then 1073741823
else columns.max_length
end
) as length
, columns.max_length
, columns.precision as prec
, cast(0 as bit) as cdefault
, cast(0 as bit) as isoutparam
以上sql在sqlserver2005中可以正确执行,但在sqlserver2000中出错:在关键字 'precision' 附近有语法错误。
这是什么问题???
------解决方案--------------------你用的是sys.columns吗,这个只有在2005才有,在2000是没有的,必须要修改,2000的只有syscolumns
------解决方案--------------------用这个试试:INFORMATION_SCHEMA.columns
------解决方案--------------------你改改
--1. SqlServer2000数据库字典--表结构.sql
SELECT TOP 100 PERCENT --a.id, s
CASE WHEN a.colorder = 1 THEN d.name
ELSE ''
END AS 表名 ,
CASE WHEN a.colorder = 1 THEN ISNULL(f.value, '')
ELSE ''