Getting error "Insert: Incorrect syntax near the keyword 'from'." when using Insert fuction

Hello I have a UiPath flow where I am running a truncate query (see below)
database…tableA end”

Then I am using database.insert function to insert new rows from a data table variable …
When I run the insert function alone it works perfectly fine
when i run the truncate query before the Insert function it throws this error

Insert: Incorrect syntax near the keyword ‘from’.

please advise

Put the whole query on one line, no line breaks.

Hello I gave that a try no luck. the query with the truncate statement runs fine its the insert function that throws the error . But if I comment out the query statement then the insert function runs fine …

You can’t do them all in one activity. You’ll have to send them each as individual queries.

Yes each is in its own Sequence with in the UiPath flow

Are you using the Insert activity, or the query activity with a SQL INSERT statement?

Either way, show how you have it configured.

Insert activity

I have execute Query activity that is "“begin TRUNCATE TABLE database…tableA end”
Then I have Insert Activity that is inserting a data table .

Both functions work fine individually in the flow but when both are not commented out it errors out on the insert activity with error “Insert: Incorrect syntax near the keyword ‘from’.”

I would try connect, clear rows, disconnect, connect, insert.

Yeah I tried that as well prior didn’t work…

It might all be happening too fast, the insert is happening before the truncate completes. Maybe try a delay between the two.

yeah tried a 15 sec delay as well before I came here no luck…


Try to use them in tqo differnt workflows and check if that works with different connect and disconnects


Hi @tdutcher ,

Could you let us know if the Error was received again or the resultant was not the correct result ?

Also, was the query checked in SQL Studio itself whether it works properly?

Yes independently of each other they work fine but when in same work flow it throws the error

The truncate query runs fine on sql and in the UiPath flow it is erroring out in the insert function but when the execute query function is commented out the insert runs fine


I am asking you to keep them in two different workflows and invoke them one after the other…sot hat it looks like a sequencial flow and in invoke workflow activity use isolated option so that it might work


Ok sounds good will give this a try tomorrow and report back thank you !

1 Like

Hello Anil ! this worked perfect ! thank you so much ?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.