34,587
社区成员
发帖
与我相关
我的任务
分享
create table tb(id int,zdm varchar(10),yhid int,xmid int,字段名 varchar(10))
insert into tb select 1,'yhid',1,2,'数据'
go
declare @s nvarchar(1000)
select @s=zdm from tb where id=1
set @s='select '+@s+' from tb'
exec(@s)
/*
yhid
-----------
1
(1 行受影响)
*/
go
drop table tb