Jump to content

[SOLVED] Field Split on Database Level


wsantos

Recommended Posts

Nope XXXXXX is a variable length string. Field 2 and 3 is fixed length so I can split it. Another issue is I can do this on a script but we are wondering if we can split it on database level. If so, how. Or perhaps a link to a resource. Thanks

This works, there might be a better way of doing it, you just need to change data to the field name

 

SELECT SUBSTRING_INDEX(data,' ',1) AS col1,

LEFT(SUBSTRING_INDEX(data, ' ', -1),5) AS col2,

SUBSTRING_INDEX(data, '-', -1) AS col3

FROM table_name

 

let me know how you get on

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.