Results 1 to 2 of 2
  1. #1
    riaarora is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    25

    Extract SUB String using SELECT Statement

    Hi All,

    How to extract a portion on based of search criteria from a Column string using SELECT statement.

    I have a table with below structure:

    Table A Structure
    =============
    Name
    Description
    Transaction
    Value

    Name: James
    Description: Redemption: MMTIME AUD, 3.295%, 25.07.12-01.08.12 (90562)
    Transaction:Close Loan: Mortgage SGD, 3.2625%, 24.07.12-07.08.12, 264308
    Value:$1092

    I want to extract 90562 from Description
    and 264308 from Transaction



    but issue is length of the field is not fixed. First field will be between "()" e.g. (90562)
    and second field will be after , e.g. ",264308"

    Appreciate your help.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    You would do yourself an major favor if you were to design your tables with explicit fields. Too often people, using DBMS with little background, don't do the required design and use the "shoebox method". A few text or memo fields and plop in whatever takes your fancy. Then the realization that you can't do much with a "shoe box" full of disjoint things that now have special meaning, and may even be related.

    You have lost/hidden the meaning of each of these substrings and now must go through contortions to find, extract and use them.

    You may find your first string with the (), but your second string has a space after the comma - so it won't work as you have shown.

    Is the second string you need always 6 contiguous digits? Is it always the last part of the field?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-08-2012, 02:45 PM
  2. Extract Value from Variable in String
    By nguyenak in forum Programming
    Replies: 3
    Last Post: 05-24-2012, 03:50 PM
  3. Extract String From Between 2 Values
    By kathleencampbell in forum Queries
    Replies: 5
    Last Post: 03-23-2012, 10:52 AM
  4. Convert Number to String in .csv extract
    By CindyR19 in forum Import/Export Data
    Replies: 3
    Last Post: 08-17-2011, 02:58 PM
  5. Extract numbers from text string strored in a field.
    By khabdullah in forum Programming
    Replies: 2
    Last Post: 12-23-2007, 06:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums