Reputation: 93
Im trying to remove all instances of double quotes from an entire SQL table, and replace these double quotes " " with signle quotes ' '. Is there an efficient way to do this? thanks!
Upvotes: 0
Views: 1747
Reputation: 15905
If you just want to select that column without any double quote in it:
SELECT *,REPLACE(columnname, '"','') FROM tableName
If you want to update you column by replacing all the double quote(") then Gordon provided you the right answer.
update tablename select columnname = replace(columnname, '"', '') WHERE charindex('"',columnname)>0
Upvotes: 1
Reputation: 32614
To replace double quotes with single quotes, simply do
Update table
set column=replace('"','''')
where column like '%"%'
Upvotes: 1
Reputation: 1270873
If you want to change the column names, you would need to update
the table:
update tablename
select column_name = replace(column_name, '"', '')
where column_name like '%"%';
Upvotes: 0