First page Back Continue Last page Image

CREATE TABLE `knumstrings` (

-- Let us have the database provide a unique key

`ksID` INT(5) AUTO_INCREMENT,

-- The String Version of an Integer

`ksInteger` CHAR(15) NOT NULL,

-- The String Version of a simple Decimal

`ksDec1` VARCHAR(15),

-- The Sting Version of a more complex positive Decimal

`ksDec2` VARCHAR(15),

-- Same thing but negitive

`ksDec3` VARCHAR(15),

-- Extra copy so I can play with it

`ksDec4` VARCHAR(15),

-- String Version of a Double

`ksDouble` VARCHAR(15),

-- String Version of a Float

`ksFloat` CHAR(15),

-- Indicate the primary key for this table

PRIMARY KEY(`ksID`)

);

-- Populate additional data into table

INSERT INTO `knumstrings` VALUES

(NULL,'10','1.2','1234567.89','-1234567.89','1234567.89','1234567.89','1234567.89'),

(NULL,'5+5','+1.2','1234*567.89','-1234/567.89','1234.567.89','1234/567.89','1234/567.89'),

(NULL,'a','a','a','a','a','a','a');

If the strings can be resolved to a number, then the conversion works, but if they cannot the conversion is less reliable

+

=

Notice the use of Operators in the original Data

When Implicit Conversions Get Tricky