sql server2008 获取动态sql的变量值
--通过SQL 字符串 查询 获取查出的值sp_executesql
declare @QuerySql nvarchar(500),@uid int,@Ucode varchar(100);
set @QuerySql='select @uid=iuserid,@Ucode=cusercode from sys_user where iuserid=1'
exec sp_executesql @QuerySql,N'@uid int output,@Ucode varchar(200) output',@uid output,@Ucode output
print @uid,@Ucode
本文来自博客园,作者:方金,转载请注明原文链接:https://www.cnblogs.com/Gold-fangjin/p/5586798.html