SQL Insert value that contains apostrophe


#1

Hi,
I am trying to insert a datatable into a SQL server DB table. I am getting error “Incorrect syntax near ‘,’.” What do you think the reason might be, because i am not writing a sql query, I am just inserting the whole datatable. I made sure, that both the table and datatable have similar columns.


#2

Hey,
same issue here, any news?
Eduard.


#3

Hey, in my case the reason was that I was trying to Insert empty Data table, If condition to check if data table has any values fixed the issue.
Good luck,
Eduard.


#4

Hey, In my case, one of the column has special characters. I tried to save the error message in the column and the message has some special characters.


#5

How did you replace them in a data table if you don´t mind mentioning?
Thanks
Eduard.


#6

I found the solution in the below link. Escape the apostrophe (i.e. double-up the single quote character) in your SQL: