php-crud-api
php-crud-api copied to clipboard
SQL Server tables with triggers defined throw an error
When inserting into a SQL Server table that has a defined trigger, the following error is produced:
{"code":9999,"message":"SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The target table 'TableName' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause."}
This appears to be the generated SQL server statement being generated (pulled from Wireshark, 'id' is the name of my PK):
INSERT INTO "TableName" ("Col1","Col2","Col3") OUTPUT INSERTED."id" VALUES (@P1,@P2,@P3)
This stack overflow post seems to indicate that the use of OUTPUT is unsafe, though I'm not certain of the veracity of that.
https://stackoverflow.com/questions/13198476/cannot-use-update-with-output-clause-when-a-trigger-is-on-the-table