title: Select TOP x From table
body: <p>This is a rather unique problem and I don;t know if there is an answer. Im trying to input a variable amount of records to insert into a table depending on the value of another table. This is what I have tried</p>
  
  <pre><code>insert into TABLE1
  select TOP cast((select Value from TABLE3 WHERE column_name = 'blah') as int) * from TABLE2 
  </code></pre>
  
  <p>So im trying to get the value from table 3, and use that value to grab the top x records from table 2 to be inserted into table 1.</p>
  
  <p>the error listed is Incorrect syntax near cast.</p>