• After use this function I retrive result without 2 chars.

    When i replace code from:

    SET @len = DATALENGTH(@pbinin)

    to:

    SET @len = DATALENGTH(@pbinin)+1

    resultset contains all chars.