Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Posts
    164

    Unanswered: Stripping off last few characters

    I want to strip off the last three characters from an item number. The only thing is tht every item number is not the same lenght. The last three characters of this number are packing codes that I do not need. Fore example I can have all these numbers:

    EFJ50701033
    EFW1546066
    RFM4925156
    70561033
    89541899

    How would I remove the last three characters and only remain with whatever is in front of those three characters?

    Any help is greatly appreciated!

  2. #2
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Stripping off last few characters

    Update Table1
    Set Col1=left(Col1,len(Col1)-3)

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Better yet....normalize your data..they should be in their own column....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jan 2004
    Posts
    164
    So it would look like this:

    Update Sales_history
    Set item_code=left(item_code,len(Col1)-3)?

    Say I wanted to Select all this and place it in another table. A new table that I would create. Lets call it NewSales_history. how would I go about this, I still want to keep the current table the way it is.

  5. #5
    Join Date
    Jan 2004
    Posts
    164
    Also not all item codes are the same lenght. Thats why I am a little confused.

  6. #6
    Join Date
    Jan 2004
    Posts
    164
    i understand it now......it works perfectly. Thanks once again for your help. This is how I did it.


    select item_code=left(item_code, len(item_code)-3),
    cust_code, date_cust_invoice
    from merged_sales_history_detail

  7. #7
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393
    Insert into NewTable
    (code)
    select left(item_code,len(Col1)-3)
    from Sales_history

Posting Permissions

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