How to check if the data in the field is decimal using sql sysntax?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    How to check if the data in the field is decimal using sql sysntax?

    I have bunch of data in the table in my database, the field is in a varchar type, the field has deimal numbers, has integers, has letters etc. i only want to check if the data in that field is a decimal, how can i check that using only mysql syntax? no php.

    Any comment are so apprecitaed, thank you. :)
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Look for a dot in the string in addition to whether it's numeric.

    Comment

    • Exequiel
      Contributor
      • Jul 2012
      • 288

      #3
      @rabbit how can i code it into mysql?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You could use the regexp operator

        Comment

        Working...