数据库
首页 > 数据库> > 动态SQL赋值

动态SQL赋值

作者:互联网

declare @OrdNo Nvarchar(100), @Memo Nvarchar(100),@NoList Nvarchar(1000),@sql Nvarchar(4000)
set @NoList=' where a.No in (''SO0000002'',''SO0000004'')'
set @sql='select @OrdNo =no,@Memo = ''销售订单[''+No+'']导出'' from T_SalesOrder a' +@NoList
print @sql
execute sp_executesql @sql ,N'@OrdNo nvarchar(100) output,@Memo nvarchar(100) output',@OrdNo output,@Memo output
print @OrdNo
print @Memo

标签:NoList,OrdNo,Memo,SQL,sql,100,动态,Nvarchar,赋值
来源: https://www.cnblogs.com/edrp/p/16149147.html