开发者

Stored Proc, how to select into multiple variables?

My Stored Proc is not behaving how I would expect. I am expecting to populate multiple variables from 1 select statement.

Like this:

Declare @Phone nvarchar(30); 
Declare @Fax nvarchar(30); 

select @Phone = phone , @Fax = fax from customer where customerID = 1;

However, the variables are always blank after this select. I am sure the result set is scalar, and data actually exists.

Where is the 开发者_StackOverflow中文版obvious blunder, and thanks!


That should work, I think (I'm sure someone will correct me!).

You're absolutly sure the data exists?

and if you add a

print @Phone
print @Fax

immediatly after, they're both blank?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜