'Remove certain character from column values
I have a table that has multiple columns and all the string in that column starts and ends with a semicolon.
following is the table
ID Name
"sdadsa" "Something"
"sdadsa" "Something2"
"sdadsa" "Something"
I want a SQL query that can remove all these double quotes from the SQL table and should look like.
ID Name
sdadsa Something
sdadsa Something2
sdadsa Something
Solution 1:[1]
There's is built-in functions you can use to achieve it
update table set Name = right(left(Name,LEN(Name)-1),len(Name)-2) where Name like '"%"'
same for Id
update table set Id = right(left(Id,LEN(Id)-1),len(Id)-2) where Id like '"%"'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gary Martirosyan |
