title: Can you call a SQL Stored Procedure that returns a record set and have those values loaded into variables?
body: <p>Please consider the following SQL Server table and stored procedure. </p>
  
  <pre><code>create table customers(cusnum int, cusname varchar(50))
  
  insert into customers(cusnum, cusname) values(1, 'Ken')
  insert into customers(cusnum, cusname) values (2, 'Violet') --The Wife
  
  create procedure getcus 
    @cusnum int
  as 
  Begin
     select cusname
     from customers (nolock)
     where cusnum = @cusnum
  End
  </code></pre>
  
  <p>You know how you can write T-SQL code like this:</p>
  
  <pre><code>declare @cusname varchar(50)
  
  select @cusname = cusname
  from customers 
  where cusnum = 1
  </code></pre>
  
  <p>Can I do this with my stored procedure? </p>
  
  <p>for example the code would look like this:</p>
  
  <pre><code>declare @cusnum int
  declare @cusname varchar(50)
  
  set @cusnum = 1
  
  exec @cusname = cusname pbogetcus @cusnum
  </code></pre>
  
  <p>Thanks in advance. </p>