How to update one column based on the length of data in another column

I need to mark a column with a value...based on the length of data in another column.
Something like this....

UPDATE    myTable
SET              status = 'invalid'
WHERE     length(phone)<10

also....if the phone data contains text in the first 10 characters.
MikeCombeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
Try something like:
UPDATE    myTable
    SET              status = 'invalid'
    WHERE     len(phone)<10
        OR ISNUMERIC(SUBSTRING(phone, 1, 10)) = 0

Open in new window

0
 
MikeCombeAuthor Commented:
perfect. thanks !
0
All Courses

From novice to tech pro — start learning today.