Results 1 to 13 of 13

Thread: How do I extract only numbers from a field? (Ms Access Sql query)

Hybrid View

  1. #1
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How do I extract only numbers from a field? (Ms Access Sql query)

    Mid(Field1, 1, Len(Field1)) isn't much use, at it is just a very long-winded way of writing Field1

    Field1 Like '%[0-9]%' would be a very good thing to put in a Where clause for this (as it will quickly eliminate any rows that don't have numbers in them), but in the Select clause won't do much good (it will return True/False [or 0/1] depending on whether there are any numeric characters in the field).


    As to how you should approach this, it depends heavily on the kind of values you have got and exactly what you want to return based on those values.

  2. #2

    Thread Starter
    Lively Member Christhemist's Avatar
    Join Date
    Sep 2016
    Location
    Nevada
    Posts
    116

    Re: How do I extract only numbers from a field? (Ms Access Sql query)

    Input:

    1234 Apple Hill Road.

    Output:

    1234

  3. #3

    Thread Starter
    Lively Member Christhemist's Avatar
    Join Date
    Sep 2016
    Location
    Nevada
    Posts
    116

    Re: How do I extract only numbers from a field? (Ms Access Sql query)

    Some will be like this

    Input:

    Po Box 1234

    Output:

    1234

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width