sql - Nvarchar column value is doubled, how do I detect and fix this? -


i've inherited project somehow ended random rows in application settings table getting duplicated. got duplicate rows removed successfully, noticed actual values, of type nvarchar, said rows duplicated.

for instance, 1 row has key column error email address , value column websupport@mycompany.com,websupport@mycompany.com. value column should contain websupport@mycompany.com. there numerous records this, following same pattern of the value,the value.

how can detect when value column contains kind of duplicated data , correct it?

note comma alone not enough row invalid, because things key default error message value oops, went wrong correct , contain comma.

here query:

update tablename set col1=substring(col1,0,charindex(',',col1)) substring(col1,0,charindex(',',col1))=substring(col1,charindex(',',col1)+1,500) 

replace col1 column name, , tablename actual table name. replace rows value before , after comma(,) same single value.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -