how to replace multivalue

  • my bank has change their account from 5 digit to 8 digit.

    every account has been changed by adding '212' in the end of account number.ex:

    11111 ----> 11111212

    22222 ----> 22222212

    etc

    i have many table with field account number. so, how to make stored procedure to accomplish this matter.

    thanks for your help:-)

  • diboy79 (3/25/2011)


    my bank has change their account from 5 digit to 8 digit.

    every account has been changed by adding '212' in the end of account number.ex:

    11111 ----> 11111212

    22222 ----> 22222212

    etc

    i have many table with field account number. so, how to make stored procedure to accomplish this matter.

    thanks for your help:-)

    is the account an integer or varchar? it makes a difference.

    wouldn't it be something like this?:

    --varchar

    UPDATE YOURTABLE

    SET Account = Account + '212'

    WHERE LEN(Account) = 5

    --int?

    UPDATE YOURTABLE

    SET Account = (Account * 1000) + 212

    WHERE Account between 10000 AND 99999

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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