Krishna Chaitanya M
Krishna Chaitanya M

Reputation: 227

How to Insert special characters in SQL Server 2008 R2?

I am trying to collect news articles and store the content in a db. I need to do it quickly say 300 news articles in less than 15mins time. The news content is having lots of special characters in between like "'" etc. Is there any way to say the database to ignore those characters while writing to the database? Insert query is failing.

Thanks.

Upvotes: 0

Views: 2844

Answers (3)

TomTom
TomTom

Reputation: 62093

I need to do it quickly say 300 news articles in less than 15mins time

Other people would consider your definition of quick as very slow. 300 article inserts should go in 15 seconds, not 15 minutes.

Insert query is failing

Show the query please plus the error. if you use parameters you have no problem with that unless your data is too long to handle properly in a parameter.

Upvotes: 0

Krishna Chaitanya M
Krishna Chaitanya M

Reputation: 227

I was wrong, i did not analyse the issue correctly, its just the quote that is effecting the query and i droped the quote instead of adding double quotes to escape as it doesn't make any difference.

if not using like then only ' will be the issue in SQL Server 2008 - point learnt.

Thanks.

Upvotes: 0

AdaTheDev
AdaTheDev

Reputation: 147224

Parameterise your INSERT statement - you'll save yourself a lot of problems like this. The other benefits of doing so include execution plan reuse (good for performance) and SQL injection protection.

Upvotes: 1

Related Questions