I need to split comma delimited string into a second columns I have the following table :
CL1 POS POS2 LENGHT ALLELE
1 301
MySQL doesn't have a built-in CHARINDEX() function. LOCATE() would be the MySQL equivalent.
Using SUBSTRING_INDEX() might be a more succinct way of doing this. Something like this (disclaimer: untested):
SUBSTRING_INDEX(POS, ',', 1) for POS
SUBSTRING_INDEX(POS, ',', -1) for POS2
As an aside, I may be misunderstanding what you're trying to accomplish, but it looks like you might want to UPDATE existing rows, not INSERT new ones? Something like:
UPDATE MyTable SET POS2 = SUBSTRING_INDEX(POS, ',', -1);
UPDATE MyTable SET POS = SUBSTRING_INDEX(POS, ',', 1);
MySQL does have a similar function: InStr or for the same syntax Locate.