title: How to concatenate variables into SQL strings
body: <p>I need to concatenate a variable table name into my SQL query such as the following...</p>
  
  <pre><code>ALTER FUNCTION fn_myfunction(@KeyValue text)
  BEGIN
       INSERT INTO @tmpTbl1
       SELECT @KeyValue AS fld1
       FROM tbl + @KeyValue + KeyValue.fld1
  </code></pre>
  
  <p>I also attempted the following but it told me I had to declare the table variable?</p>
  
  <pre><code>ALTER FUNCTION fn_myfunction(@KeyValue text, @KeyTable text)
       FROM @KeyTable.fld1
  </code></pre>