Results 1 to 2 of 2

Thread: Change a char in a char(20) globally in a table

  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Change a char in a char(20) globally in a table

    Sample record has '1213v1333'
    I need to change 'v' to 'x' through all records.

    How do I do that?

    Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    if it is sql server use REPLACE function.

    create table ree (name char(20))
    go
    insert into ree select '1213v1333'
    insert into ree select '233v78773'
    insert into ree select '1213v6778'
    insert into ree select '44313v5633'
    insert into ree select '4443v1433'
    go
    --before updating
    select * from ree
    --Update
    update ree set name = replace(name,'v','x')
    --After updating
    select * from ree

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •