• The CROSS APPLY and SUBSTRING below should do what you need. Let us know if you need some clarification for getting it into an UPDATE statement.

    DECLARE @leading_trailing_chars_to_eliminate varchar(10)

    SET @leading_trailing_chars_to_eliminate = CHAR(9) + SPACE(1)

    ----------------------------------------------------------------------------------------------------

    DECLARE @patindex_pattern varchar(20)

    SET @patindex_pattern = '%[^' + @leading_trailing_chars_to_eliminate + ']%'

    SELECT

    '~~' + remarks + '~~' AS [~~remarks_original~~],

    '~~' + SUBSTRING(remarks, starting_byte, LEN(remarks) - starting_byte - ending_byte + 2) + '~~' AS [~~remarks_updated~~]

    FROM (

    SELECT CHAR(9)+CHAR(9)+SPACE(3)+CHAR(9) + 'remarks themselves' + CHAR(9)+SPACE(2)+CHAR(9)+SPACE(1)+CHAR(9) AS remarks

    ) AS test_data

    CROSS APPLY (

    SELECT

    --find the first not-to-be-eliminated character in the string

    PATINDEX(@patindex_pattern, remarks) AS starting_byte,

    --find the last not-to-be-eliminated character in the string

    PATINDEX(@patindex_pattern, REVERSE(remarks)) AS ending_byte

    ) AS ca1

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.