Error saving globallasterror from Business Central to SQL
I am importing documents from SQL to Business Central, but when the transaction has an error, I want to save the error message in the SQL source table. When the error message has the ‘ character the task for updating the error message I have syntax error.
I tried to replace the ‘ using SQL statements but I have the same error.
The error message is like this… “Failed to create record. Direct Posting must be equal to ‘Yes’ in G/L account No. XXXXX”
and the error I get is Error near to ‘Yes’
Any Idea how I can save the error message in SQL when it has this character?
You can do this two ways.
- Use a scripting task before the sql task to replace all single quotes with double quotes
- Modify your script to turn off quoted identifiers before inserting the vlaue.
SET QUOTED_IDENTIFIER OFF;
set Name = "Failed to create record. Direct Posting must be equal to 'Yes' in G/L account No. XXXXX"
where id = '01D8EAA5-C732-EA11-A813-000D3A6523B2'
SET QUOTED_IDENTIFIER ON;
If you would like to submit an answer or comment, please sign in to the eOne portal.