Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7731935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:36:20+00:00 2026-06-01T06:36:20+00:00

I need to split comma delimited string into a second columns I have the

  • 0

I need to split comma delimited string into a second columns
I have the following table :

CL1     POS                 POS2     LENGHT     ALLELE
1       3015108,3015109              5          A
2       3015110,3015200              10         B
3       3015200,3015300              15         C
4       3015450,3015500              20         D
5       3015600,3015700              15         E

I want to split the numbers after the comma into a second column POS2
So it should like that

CL1     POS                 POS2     LENGHT     ALLELE
1       3015108             3015109  5          A
2       3015110             3015200  10         B
3       3015200             3015300  15         C
4       3015450             3015500  20         D
5       3015600             3015700  15         E

So I’ve queried the following :

INSERT INTO MyTable (POS2)
SELECT RIGHT(POS, CHARINDEX(',', POS) + 1 ) FROM MyTable ;


 It returns an error : 
 ERROR 1305 (42000): FUNCTION test.CHARINDEX does not exist
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:36:21+00:00Added an answer on June 1, 2026 at 6:36 am

    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);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would I split a comma delimited string into smaller comma delimited strings? My
I need to split a string into two variables. For example, the following would
I have a comma delimited CSV file being loaded into a String value generated
I need to split my string input into an array at the commas. Is
I need to split a string into chunks of 2,2,3,3 characters and was able
I need to split a string into two parts. The string contains words separated
I need to split an amount into multiple part and insert into an table
I have a comma delimited list of numbers. I need to match everything up
I've got a comma delimited string of id's coming in and I need some
I need to write a split function in JavaScript that splits a string into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.