declare @fdname sysname
select @fdname=quotename(name) from syscolumns
where id=object-id('你要查询的表')
and colid=3 --列的序号
if @@rowcount >0
exec('select '+@fdname+' from 你要查询的表')
select @fdname=quotename(name) from syscolumns
where id=object-id('你要查询的表')
and colid=3 --列的序号
if @@rowcount >0
exec('select '+@fdname+' from 你要查询的表')
where id=object_id('你要查询的表')
declare @fdname sysname
select @fdname=quotename(name) from syscolumns
where id=object_id('msgtable20060401')
and colid=3 --列的序号
if @@rowcount >0
exec('select '+@fdname+' from msgtable20060401')