title: How do I use SQL Server table name in select query with a variable?
body: <p>Is this incorrect, can't we pass the table name to a select query dynamically?</p>
  
  <p>This is giving me a error 'Must declare the table variable @TblName'</p>
  
  <pre><code>DECLARE @TblName VARCHAR(30)
  SET @TblName = 'User'
  SELECT * 
  FROM @TblName
  </code></pre>