HOW To remove ' in a column SQL server 2005

69 Views Asked by At

I have a specific column (description) in a particular table. I used bulk loading to insert data in table, but in retrieving data it's giving an error because of this column (description).

The problem is occuring due to ' in description (like 12' height). So how can I remove this ' in that column?

1

There are 1 best solutions below

0
On

[Is sounds like you are running some kind of script that fails when it tries to insert a value with a single quote in its value, between two quotes in code or dynamic sql. Your problem won't be in the database, it will be where you are processing it. A quick hack would be to run an update replace. In this case I am deleting your empty quotes.

Update [tablename] set [description] = replace([description],char(39),'')
where [description] like '%' + char(39) + '%'

However this is just a hack....your problem is somewhere else where you are retrieving and processing the data