SQL SERVER 中怎么把表中的数据赋值给存储过程的变量?

如题所述

declare @id int
select @id = user_id from users where name = '张三' -- 从users表读取张三的user_id,并赋值给变量@id
execute upYourProc @id --将变量传递给存储过程。
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-09-26
declare @id int;
select @id = user_id from users where name = '张三';
execute upYourProc @id --将变量传递给存储过程;
相似回答