Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

mysql extract number from string

SELECT CAST(SUBSTRING(myStringWNumber, posNumStart, posNumEnd), <NUM_TYPE>) FROM table;

<NUM_TYPE>
SIGNED	  Converts value to SIGNED (a signed 64-bit integer)
UNSIGNED  Converts value to UNSIGNED (an unsigned 64-bit integer)
BINARY	  Converts value to BINARY (a binary string)
DECIMAL	  Converts value to DECIMAL. Use the optional M and D parameters 
          to specify the maximum number of digits (M) and the number of digits 
          following the decimal point (D).
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mysql #extract #number #string
ADD COMMENT
Topic
Name
7+8 =