replace statement

  • guys,

    hope you are doing well,

    I got a phone number field... lets call it phone the number is that field stats with 1.. I wanna replace 1 with nothing

    155555555111

    after running the update I wanna look like this:

    55555555111

    Thanks

     

     

     

     

  • Assuming that phone number is a character data type...

    UPDATE mytable

    SET PhoneNumber = RIGHT(PhoneNumber, LEN(PhoneNumber) - 1)

    WHERE LEFT(PhoneNumber, 1) = '1'

  • it worked just fine...

    Thank You

     

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

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