title: Store query result in variable
body: <p>I have declared 6 variables in a stored procedure and I'd like to store a query result (which may bring up to 6 records) into each one of those variables. My query looks like this:</p>
  
  <pre><code>  DECLARE
      @Sib1 varchar(20),
      @Sib2 varchar(20),
      @Sib3 varchar(20),
      @Sib4 varchar(20),
      @Sib5 varchar(20),
      @Sib6 varchar(20)
  
  select
      PC.SKU
  from
      Product PC
      where
          Parent_code in (select
                                    Parent_code
                                from
                                    Product 
                                where
                                    SKU =12345)
          and ParentFlag &lt;&gt; 'p'
          and SKU &lt;&gt; 12345
  order by Parent_Child_Priority desc
  </code></pre>
  
  <p>I'd like to put each one of the resulting SKU in each @SIB variables. if it only returns 1 result, I'd like to put null values into the rest of the @SIB variables.</p>
  
  <p>Thanks.</p>