One of the value contains single quotation thats why its breaking the sql insert command. So it was replaced & then executed.
Unclosed quotation mark after the character string.
D Mallikarjuna Reddy
96
Reputation points
I am using Azure Automation Runbooks to insert some data into Azure SQL.
We have 17k lines of data and this below query is being failed for only 3 rows. Not sure what's wrong here.
2 answers
Sort by: Most helpful
-
-
AnuragSingh-MSFT 21,466 Reputation points
2023-07-12T07:27:25.4233333+00:00 @D Mallikarjuna Reddy , thank you for sharing the solution with the community.
You may also consider using the
-variable
parameter withInvoke-Sqlcmd
so that the query string does not terminate unexpectedly when delimiters like ";" or singlequotes are there in the values to be inserted. For details, see -variable in Invoke-Sqlcmd