日期:2014-05-17 浏览次数:20510 次
exec (select Name from admin where id = 1)
declare @name varchar(20)
declare @name varchar(20),@tsql nvarchar(4000)
select @tsql=N'select @name=Name from admin where id=1'
exec sp_executesql @tsql,N'@name varchar(20) output',@name=@name output
select @name
declare @name nvarchar(20)
exec sp_executesql N'select @name = Name from admin where id = @id',
N'@name varchar(20) output,@id int',
@name out,1
select @name
DECLARE @ta TABLE (NAME varchar(50))
DECLARE @NAME varchar(50)
INSERT @ta EXEC('select Name from admin where id = 1')
SELECT @NAME=NAME FROM @ta