The following function will return a string devoid of the supplied characters in the second parameter:

USAGE:

SELECT dbo.fnStringReplace(‘MyTestString-*&@’, ‘&@-*’)

FUNCTION:

/*
Purpose:
Returns a string devoid of the given characters.
Type:
Scalar Return
Prototype:
Print dbo.fwt_StringReduce(‘Bob Herguth@#$^&*()’, ‘@#$^&*()’)
*/
CREATE FUNCTION fwt_StringReduce
(
@inputstr VARCHAR(4096)
, @stripchrs VARCHAR(255)
)
RETURNS VARCHAR(4096)
AS
BEGIN
DECLARE @charcounter INT
SET @charcounter = 1
WHILE  @charcounter <= LEN(@stripchrs)
BEGIN
SET @inputstr = REPLACE(@inputstr, SUBSTRING(@stripchrs, @charcounter, 1), ”)
SET @charcounter = @charcounter + 1
END
RETURN @inputstr
END

Steve Lugovsky, singing out