Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    4

    Unanswered: trim last 4 characters of a column and replace them

    I'm trying to write a sql statement to trim a column and replace them with the same characters. I'm stumped

    This is what I have

    123456-1231-001
    123456-1232-002
    123456-1233-003


    I want to change this to
    123456-1231-000
    123456-1232-000
    123456-1233-000

    I am going down this trail...

    update tablename A set A.columnname = select substr(columnname, 1,12)||'000' from tablename where columname = A.columname);

  2. #2
    Join Date
    Feb 2001
    Location
    NC, USA
    Posts
    200
    This will do it:
    Code:
    UPDATE tablename 
      SET columnname = SUBSTR(columnname,1,12) || '0000'
    /

Posting Permissions

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