declare @id intselect @id = user_id from users where name = '张三' -- 从users表读取张三的user_id,并赋值给变量@idexecute upYourProc @id --将变量传递给存储过程。
declare @id int;select @id = user_id from users where name = '张三';execute upYourProc @id --将变量传递给存储过程;