Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    25

    Question Unanswered: Is there a IsAlpha/non-numberic function in SQL?

    Hi,

    I need to check to see if a value from one my tables is non-numeric or all alpha characters. Is there a function in Informix to check for this?

    Thanks.

    Matt

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT myColumn AS pure_numeric
       FROM myTable
       WHERE  myColumn NOT LIKE '%[^0-9]%'
    
    SELECT myColumn AS contains_non_numeric
       FROM myTable
       WHERE  myColumn LIKE '%[^0-9]%'
    
    SELECT myColumn AS pure_alpha
       FROM myTable
       WHERE  myColumn NOT LIKE '%[^A-Za-z]%'
    
    SELECT myColumn AS contains_non_alpha
       FROM myTable
       WHERE  myColumn LIKE '%[^A-Za-z]%'
    Depending on how complex you want to get, this ought to give you a pretty good start.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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