Is there a more elegant way of doing this. I want to replace repeating blanks with single blanks....
declare @i int
set @i=0
while @i <= 20
Lets say, your Data like this
Table name : userdata Field: id, comment, status,
id, "I love -- -- - -spaces -- - my INDIA" , "Active"
id, "I love -- -- - -spaces -- - my INDIA" , "Active"
id, "I love -- -- - -spaces -- - my INDIA" , "Active"
id, "I love -- -- - -spaces -- - my INDIA" , "Active"
So just do like this
update userdata set comment=REPLACE(REPLACE(comment," ","-SPACEHERE-"),"-SPACEHERE"," ");
I didn't tested , but i think this will work.