|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
remove duplicate charatectes in a string
Hi
I would like to know how I can remove the duplicate characters in a string eg abcdedgh@@@@@@@test.com using a sql select I want the results = abcdedgh@test.com ( ie removing the extra @ ) Thanks Tissa |
|
#2
|
||||
|
||||
|
Something like this perhaps?
Code:
DECLARE @string CHARACTER VARYING(255)
SELECT @string = 'abcdedgh@@@@@@@test.com'
SELECT @string AS 'Before'
WHILE charindex('@@', @string) > 0
BEGIN
SELECT @string = REPLACE(@string, '@@', '@')
END
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 Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
This is the script I was looking for - your are a legend !
Thanks for your quick post - appreciate it ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > remove duplicate charatectes in a string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|