September 1st, 2003, 09:05 PM
remove duplicate charatectes in a string
I would like to know how I can remove the duplicate characters in a string
using a sql select
I want the results = email@example.com
( ie removing the extra @ )
September 2nd, 2003, 05:48 PM
Something like this perhaps?
DECLARE @string CHARACTER VARYING(255)
SELECT @string = 'abcdedgh@@@@@@@test.com'
SELECT @string AS 'Before'
WHILE charindex('@@', @string) > 0
SELECT @string = REPLACE(@string, '@@', '@')
SELECT @string AS 'After'
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
September 4th, 2003, 08:00 AM
This is the script I was looking for - your are a legend !
Thanks for your quick post - appreciate it