I have a table that i am modifying the schema of, and am having a particular 
problem with my data migration program. The old format has a column defined 
as:
Range char(3) not null default '',

which is either'' or contains a number (1 or 2 digits), and is sometimes 
followed by a direction (N,S,E,W)

In the schema that im migrating to, the definition has changed so that there 
are 2 columns:
Range TINYINT UNSIGNED NOT NULL DEFAULT 0,
Range_Direction char(1)


I have a Perl script that is doing a SELECT INTO OUTFILE on the old table, and 
a LOAD DATA INFILE into the new table. I havent been able to figure out a 
SELECT clause that will properly break up the old Range.

Using a SELECT clause query like:
SELECT Range REGEXP "^[0-9]+", Range REGEXP "[NSEW]$" FROM ...

will tell me about whether the Range column value is actually what it should 
be, but i was looking for a function that would give me the specific string 
that matched the regex, for instance using the above regexes on a range value 
of '32E', the first part matches '32' and the second part matches 'E'.
REGEXP just gives whether the pattern matched the expression.

This is very easy in Perl, is there any way to do it in MySQL?

thanks much
sean peters
[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to