declare @Colname varchar(100) select set @ColName=[name] from syscolumns where id=object_id('表名') and colid=1 exec('select '+@Colname+' from [表名]')
declare @Colname varchar(100) select top 1 @ColName=[name] from syscolumns where id=object_id('表') order by colorder exec('select '+@Colname+' from [表]')
select set @ColName=[name] from syscolumns where id=object_id('表名') and colid=1
exec('select '+@Colname+' from [表名]')
select top 1 @ColName=[name] from syscolumns where id=object_id('表')
order by colorder
exec('select '+@Colname+' from [表]')