title: Retrieve data from either of table based on column value in MSSQL
body: <pre><code>Create table test
  (
  id int,
  Name varchar(50),
  ObjType varchar(50)
  Typeval varchar(50)
  )
  </code></pre>
  
  <p>I have 2 other tables named say tbl1 and tbl2</p>
  
  <p>Based on value in ObjType in table "test", I have to retrieve column from tbl1 or tbl2. 
  NOte: Column name i want to retrieve is not same in tbl1 and tbl2.</p>
  
  <p>something like this:</p>
  
  <pre><code>SELECT Name, Objtype,id, typeval, 
   Desc = CASE WHEN objtype='abc' THEN 
                   SELECT col1 from tbl1 WHERE cond=id (col from table test) 
               WHEN objtype = 'xyz' THEN 
                   SELECT cola from tbl2 WHERE crit = id (col from table test)
  </code></pre>
  
  <p>Can any body guide me</p>