22,209
社区成员
发帖
与我相关
我的任务
分享
print(@prostr)
print @prostr
declare @prostr nvarchar(50)
set @prostr= select top 1 colorder from syscolumns where name= '性别' and id = object_id('G_staff')
--查询变量值
print @prostr
select @prostr
print @prostr
select @prostr
select @prostr
declare @prostr nvarchar(50) --声名
set @prostr= (select top 1 colorder from syscolumns where name= '性别' and id = object_id('G_staff') ) --赋值
select * from sample where id = @prostr --调用
补个*declare @prostr nvarchar(50)
set @prostr= select top 1 colorder from syscolumns where name= '性别' and id = object_id('G_staff')
print @prostr --或者 select @prostr
declare @prostr nvarchar(50) --声名
set @prostr= (select top 1 colorder from syscolumns where name= '性别' and id = object_id('G_staff') ) --赋值
select from sample where id = @prostr --调用