如何按序号取得某张表中的某个字段的值?
我要取第5个字段的值:
select field(5) from tableName
显然是不行
怎么做呢?
[解决办法]
declare @a varchar(1000)
select @a= 'select '+name + ' from [TableName] ' from syscolumns b where id=object_id( '[dbo].[TableName] ') and colid=5
exec(@a)
[解决办法]
支持楼上