Count characters in a row of data

  •  

    Hi,

    Is it possible to count the number of characters in a row?  I have a column that represents an amount of time. And the format is '00:00:00' <---which is 8 characters.  However, some columns have 7, 9, or even 6 or 10 characters because of data entry errors.

    So I'm trying to write a select statement, that finds all rows in that column that do not conform to the format '00:00:00'. 

    I tried using COUNT, but that didn't seem to work.

    Thanks!

     

  • declare @MyVarchar  VARCHAR(25)

    SET @MyVarchar = '0:00:00'

    SELECT @MyVarchar, LEN(@MyVarchar)

    SET @MyVarchar = '00:00'

    SELECT @MyVarchar, LEN(@MyVarchar)

    Hope this helps

    Wayne

  • THANK YOU

     

    It helped and worked!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply