title: using Case get values from different table in sql server
body: <p>i need results based on a condition with out using dynamic sql</p>
  
  <p>like when <code>@param1=10</code> 
  then i need all rows details from table1 </p>
  
  <p>else i need details from table2</p>
  
  <p>i had tried something like below but it does not give the result </p>
  
  <pre><code>declare @param1 int=10;
  select * from 
  
  case when @param1=10 then table1
  
  else table2 end
  </code></pre>
  
  <p>Note : i know i can use if condition like below</p>
  
  <pre><code>if @param1=10 
  select * from table1
  else
  select * from table2
  </code></pre>
  
  <p>but in my case the query is very lengthy so i don't want to replace all query once again </p>
  
  <p>so i hope i can just do something with case with out replacing all query again.</p>
  
  <p>please help me to solve the problem </p>