declare @aid_output varchar(8),@article_name_output varchar(40)
exec sp_executesql N'select @aid1=aid,@article_name=article_name from article where aid=''00050001''', N'@aid1 varchar(8) output,@article_name varchar(40) output',
@aid1=@aid_output output,@article_name=@article_name_output output
print @aid_output
print @article_name_output
--写法二
declare @ddd_bh varchar(50),--
@ddd_djzt varchar(10),
@sql nvarchar(1000)
select @sql='select @ddd_bh=ddd_dddh,@ddd_djzt=ddd_djzt from arp_ddd where ddd_dddh=''AIR-20130801-010'''
exec sp_executesql @sql,N'@ddd_bh varchar(50) output,@ddd_djzt varchar(50) output',@ddd_bh output,@ddd_djzt output
print @ddd_bh
print @ddd_djzt