Skip to main content
added 4 characters in body
Source Link
Dale K
  • 28.1k
  • 15
  • 59
  • 85

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.:

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?

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?

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?

capitalization & clarify in question title that is exclusive to sql server 2000
Source Link
Factor Mystic
  • 26.9k
  • 16
  • 82
  • 96

INSERT INTO @TABLE EXEC @query with SQL Server 2000

isIs it true that sql 2kSQL Server 2000, you can not insert into a table variable using exec ??

iI tried this script and got an error msg "'EXECUTE cannot be used as a source when inserting into a table variable.'"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 

ifIf that true, what should iI do ??

INSERT INTO @TABLE EXEC @query

is it true that sql 2k can not insert into table variable using exec ??

i tried this script and got error msg "'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 ??

INSERT INTO @TABLE EXEC @query with SQL Server 2000

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?

tags
Link
Colin Mackay
  • 19.3k
  • 8
  • 66
  • 91
added 6 characters in body
Source Link
Anton Kovalenko
  • 21.6k
  • 2
  • 41
  • 71
Loading
Rollback to Revision 1
Source Link
Anton Kovalenko
  • 21.6k
  • 2
  • 41
  • 71
Loading
format your query
Source Link
praveen
  • 12.3k
  • 1
  • 44
  • 50
Loading
Source Link
XMozart
  • 939
  • 2
  • 11
  • 22
Loading