title: Table type of variable returning blank cells after update sql 2008
body: <p>I have a select query returning two results and what I want is to save them in a table type of variable. This is how I am doing it:</p>
  
  <pre><code>declare @CompletedTotalValues table (CMedian int, CPerc int);
  update @CompletedTotalValues set CMedian = t.CMed, CPercentile = t.CPerc
  from(               
        Select CMed = dbo.median(case when cr.Priority = 1 then cr.Days else null end),
               CPerc = dbo.Percentile90(case when cr.Priority = 1 then cr.Days else null end)
        from  A a inner join B b on b.Id = a.Id
        where b.StatusId = 3
  ) t;
  </code></pre>
  
  <p>Here, when I run the subquery, I see CMed is 25 and CPerc is 43. However, when I execute <code>Select * from @CompletedTotalValues</code>, it is returning both column blank (no value it shows). Where is my mistake? Any advice would be appreciated</p>