--通过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
时间: 2024-10-07 01:34:45