• You don't need either LTRIM nor RTRIM nor SUBSTRING.

    All it takes is:

    SELECT @stringWithTab = REPLACE(@stringWithTab, CHAR(9), '')

    .. now @stringWithTab contains 'stringWithOutTab'

    PS.

    Invalid msg about substring is when the parameters gets negative.

    DS.

    /Kenneth