Local Variables and Subqueries

A subquery that assigns a value to the local variable can return only one value.

Here are some examples:
declare @veryhigh money 
select @veryhigh = max(price) 
   from titles 
if @veryhigh > $20 
   print "Ouch!" 
declare @one varchar(18), @two varchar(18) 
select @one = "this is one", @two = "this is two" 
if @one = "this is one" 
   print "you got one" 
if @two = "this is two" 
   print "you got two" 
else print "nope" 
declare @tcount int, @pcount int 
select @tcount = (select count(*) from titles), 
   @pcount = (select count(*) from publishers) 
select @tcount, @pcount