Any one know a good way to remove punctuation from a field in SQL Server?
I\'m thinking
UPDATE tblMyTable SET FieldName = REPLACE(REPLACE(REPLACE(FieldNa
I wanted to avoid creating a table and wanted to remove everything except letters and digits.
DECLARE @p int
DECLARE @Result Varchar(250)
DECLARE @BadChars Varchar(12)
SELECT @BadChars = '%[^a-z0-9]%'
-- to leave spaces - SELECT @BadChars = '%[^a-z0-9] %'
SET @Result = @InStr
SET @P =PatIndex(@BadChars,@Result)
WHILE @p > 0 BEGIN
SELECT @Result = Left(@Result,@p-1) + Substring(@Result,@p+1,250)
SET @P =PatIndex(@BadChars,@Result)
END