Home Forums SQL Server 2005 T-SQL (SS2K5) How to escape the ^ symbol in the following function RE: How to escape the ^ symbol in the following function

  • Total guess, no testing has gone into this: -

    CREATE FUNCTION [dbo].[fn_QBRemoveNonAlphaChars] (@String VARCHAR(1000))

    RETURNS VARCHAR(1000)

    AS

    BEGIN

    WHILE PATINDEX('%[^a-z ''-]%', @String) > 0

    SET @String = STUFF(@String, PATINDEX('%[^a-z ''-]%', @String), 1, '')

    RETURN @String

    END

    You had the ^ character in your "allowed" pattern.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/