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.
Azure SQL Database
Azure SQL Database
An Azure relational database service.
6,326 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
2 answers
Sort by: Most helpful
-
-
AnuragSingh-MSFT 21,546 Reputation points Moderator
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