Unclosed quotation mark after the character string.

D Mallikarjuna Reddy 96 Reputation points
2023-07-11T11:09:37.55+00:00

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.

User's image

User's image

User's image

Azure SQL Database
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,291 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. D Mallikarjuna Reddy 96 Reputation points
    2023-07-11T12:53:25.8666667+00:00

    One of the value contains single quotation thats why its breaking the sql insert command. So it was replaced & then executed.

    0 comments No comments

  2. 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 with Invoke-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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.