Hey,
I require ALL the punctuation in a field to be removed. By all punctuation,
i mean \ / ' - ( ) * &^ % $ £ " ! etc etc.
i know i could always do a 'REPLACE' on these and just replace them with
blank spaces, but just wondering if theres any function that would allow me
to remove all the punctuation, as i dont really want to do a replace on ever
y
bit of punctuation.
Cheers
Rob.Hi
SELECT * INTO #temp
FROM
(
SELECT ' ', SPACE(1) UNION
SELECT '?', SPACE(0) UNION
SELECT '!', SPACE(0) UNION
SELECT '#', SPACE(0) UNION
SELECT '*', SPACE(0)
......
......
) AS a (Dirty, Good)
DECLARE @.String VARCHAR(50)
SELECT @.String = 'We? are* the #world!'
UPDATE #temp
SET @.String = REPLACE(@.String, Dirty, Good )
WHERE CHARINDEX(Dirty , @.String) > 0
PRINT @.String
"MACNR" <MACNR@.discussions.microsoft.com> wrote in message
news:B60345AB-9347-40A3-895F-CB4FA37EC0D3@.microsoft.com...
> Hey,
> I require ALL the punctuation in a field to be removed. By all
> punctuation,
> i mean \ / ' - ( ) * &^ % $ " ! etc etc.
> i know i could always do a 'REPLACE' on these and just replace them with
> blank spaces, but just wondering if theres any function that would allow
> me
> to remove all the punctuation, as i dont really want to do a replace on
> every
> bit of punctuation.
> Cheers
> Rob.sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment