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 8208967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:33:22+00:00 2026-06-07T09:33:22+00:00

I have table test as col_1 ———- aa,ab,ac ba,bb,bc ca,cb,cc I want output as

  • 0

I have table test as

col_1
----------
aa,ab,ac
ba,bb,bc
ca,cb,cc

I want output as

col_1     col_2    col_3
-------------------------
aa        ab       ac
ba        bb       bc
ca        cb       cc
  • 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-07T09:33:24+00:00Added an answer on June 7, 2026 at 9:33 am
    declare @T table
    (
      col_1 varchar(100)
    )
    
    insert into @T values
    ('aa,ab,ac,4,5,6,7,8,9,10'),
    ('ba,bb,bc,4,5,6,7,8,9,10'),
    ('ca,cb,cc,4,5,6,7,8,9,10')
    
    select left(T.col_1, C1.Pos-1) as col_1,
           substring(T.col_1, C1.Pos+1, C2.Pos-C1.Pos-1)  as col_2,
           substring(T.col_1, C2.Pos+1, C3.Pos-C2.Pos-1)  as col_3,
           substring(T.col_1, C3.Pos+1, C4.Pos-C3.Pos-1)  as col_4,
           substring(T.col_1, C4.Pos+1, C5.Pos-C4.Pos-1)  as col_5,
           substring(T.col_1, C5.Pos+1, C6.Pos-C5.Pos-1)  as col_6,
           substring(T.col_1, C6.Pos+1, C7.Pos-C6.Pos-1)  as col_7,
           substring(T.col_1, C7.Pos+1, C8.Pos-C7.Pos-1)  as col_8,
           substring(T.col_1, C8.Pos+1, C9.Pos-C8.Pos-1)  as col_9,
           stuff(T.col_1, 1, C9.Pos, '') as col_10
    from @T as T
      cross apply (select charindex(',', col_1)) as C1(Pos)
      cross apply (select charindex(',', col_1, C1.Pos+1)) as C2(Pos)
      cross apply (select charindex(',', col_1, C2.Pos+1)) as C3(Pos)
      cross apply (select charindex(',', col_1, C3.Pos+1)) as C4(Pos)
      cross apply (select charindex(',', col_1, C4.Pos+1)) as C5(Pos)
      cross apply (select charindex(',', col_1, C5.Pos+1)) as C6(Pos)
      cross apply (select charindex(',', col_1, C6.Pos+1)) as C7(Pos)
      cross apply (select charindex(',', col_1, C7.Pos+1)) as C8(Pos)
      cross apply (select charindex(',', col_1, C8.Pos+1)) as C9(Pos)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table: CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO
I have table to test score data that I need to pivot and I
I have this table Test as Id, SomeValue, SomeText contains about a mill records,
I have a table defined by the following SQL: CREATE TABLE test ( id
I work with Oracle 11g. I have one table: create table test (one number(2),
I have a table which stores test results like this: user | score |
I have table with following structure and test records: +--------+--------+---------+ | vid | number
In a table 'test' I have an integer field TestID, with an index. SELECT
I have a table: <table class=datatable id=hosprates> <caption> hospitalization rates test</caption> <thead> <tr> <th
I have a nested table arrangement for displaying data. I want the nested table

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.