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

4
  • tr to create the table and not to declare it
    – nbk
    Commented May 7, 2021 at 16:42
  • @nbk Thank you I changed the DECLARE to CREATE and now it runs okay!
    – aquasheep
    Commented May 10, 2021 at 20:24
  • are you sure you have the right rdms infocenter.sybase.com/help/index.jsp?topic=/… thqat looks nothing like your code
    – nbk
    Commented May 10, 2021 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
    Commented May 11, 2021 at 23:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.