• Here is a function that you can use to count the tabs in a records:

    --create this function first

    CREATE FUNCTION [dbo].[ufn_CountChar] ( @pInput VARCHAR(1000), @pSearchChar CHAR(1) )

    RETURNS INT

    BEGIN

    RETURN (LEN(@pInput) - LEN(REPLACE(@pInput, @pSearchChar, '')))

    END

    GO

    --counts the nbr tabs in string

    PRINT [dbo].[ufn_CountChar]('aaaaaaaaa',char(9) )