title: INSERT INTO @TABLE EXEC @query with SQL Server 2000
body: <p>Is it true that SQL Server 2000, you can not insert into a table variable using exec?</p>
  <p>I tried this script and got an error message:</p>
  <blockquote>
  <p>EXECUTE cannot be used as a source when inserting into a table variable.</p>
  </blockquote>
  <pre><code>declare @tmp TABLE (code varchar(50), mount money)
  DECLARE @q nvarchar(4000)
  SET @q = 'SELECT coa_code, amount FROM T_Ledger_detail'
  
  INSERT INTO  @tmp (code, mount)
  EXEC sp_executesql (@q)
  
  SELECT * from @tmp
  </code></pre>
  <p>If that true, what should I do?</p>