Is it true that SQL Server 2000, you can not insert into a table variable using exec?
I tried this script and got an error message EXECUTE cannot be used as a source when inserting into a table variable.
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
If that true, what should I do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…