1

I am trying to load a csv file into a temporary table and then run a compound SQL Statement on that table. I can get the DECLARE LOCAL TEMPORARY TABLE ... INPUT INTO ... FROM [filename] to work on its own, but trying to run a compound statement after that produces an error -131 After Insert Trigger Failed. I have no idea what that means as I'm not even using INSERT or triggers to my knowledge.

Here is the code.

DROP TABLE DynamicPLU;
    //delete the temp table

//First Table from First File, Rename Dynamic PLU Items DECLARE LOCAL TEMPORARY TABLE DynamicPLU (price VARCHAR(14), newName VARCHAR(255), inventory VARCHAR(14)); INPUT INTO DynamicPLU FROM 'C:\Shared Stuff\Database Cleanup - Peter\Project - Grab-n-Go\Grab-n-Go Item Entry Test.csv' DELIMITED BY ',';

CREATE TEMPORARY PROCEDURE GrabnGo_Update()

BEGIN

DECLARE @shortInventory INT ; SET @shortInventory = 8 ;

//a big update statement

END; CALL GrabnGo_Update();

I've also tried including the DECLARE statement in one big BEGIN END compound statement, but that produces the same error -131 right after the BEGIN statement, except in this case the code after the BEGIN statement would be DECLARE ... instead of CREATE ...

aquasheep
  • 11
  • 2
  • tr to create the table and not to declare it – nbk May 07 '21 at 16:42
  • @nbk Thank you I changed the DECLARE to CREATE and now it runs okay! – aquasheep May 10 '21 at 20:24
  • are you sure you have the right rdms http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32300.1570/html/sqlug/X10118.htm thqat looks nothing like your code – nbk May 10 '21 at 20:38
  • @nbk Is Transact SQL 15.7, which you posted a link to, the purpose of dba.stackexchange.com? Is there somewhere else I should be posting Interactive SQL 12.0.1, which I posted? – aquasheep May 11 '21 at 23:13

0 Answers0