set @sql = N'select @userIds = UserId,@companyIds = CompanyId from '+@TableName +' where Id =
'+@DataId exec sp_executesql @sql,N'@userIds int out,@companyIds int out ',@userIds out,@companyIds out select @userIds select @companyIds
将Exec的结果传给存储过程变量
最新推荐文章于 2022-08-29 09:53:16 发布
本文介绍了一个使用T-SQL编写的存储过程示例,该存储过程从指定表中根据ID获取用户ID和公司ID,并返回这两个值。此过程展示了如何动态构建SQL查询并使用输出参数。
2929

被折叠的 条评论
为什么被折叠?



