Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL
i/p table:
 
    ID   name  age  salary  skills
     101  kailsh  20  12000  tester,develper,QC analyst
o/p:
 
ID   name  age  salary  skills
101  kailsh  20  12000  tester
                        develper
                        QC analyst
 
i need to split the skills column data
Posted 29-Apr-13 23:54pm
Edited 30-Apr-13 0:03am
v2
Comments
Zoltán Zörgő at 30-Apr-13 4:59am
   
It can't be don this way. What you can get is:
ID name age salary skills
101 kailsh 20 12000 tester
101 kailsh 20 12000 develper
101 kailsh 20 12000 QC analyst

But you better split the data in two tables: normalize!
Dhritirao's at 30-Apr-13 5:03am
   
no need to repeat once again their names i just want to split the skills column data to different rows
Zoltán Zörgő at 30-Apr-13 5:04am
   
I understand, but you can't do that! It does not fit into the relational model. If you want to hide those fields you have to do it in your presentation layer. The result has to be the same if order is scrambled. Imagine what will happen with the data in your way.
Dhritirao's at 30-Apr-13 5:24am
   
actually i need to generate report in that i need to get this format.
CHill60 at 30-Apr-13 6:23am
   
Have a look at the solutions here split string column into multiple records[^] - note that the one I posted didn't work with VS2005 but there are a couple of other ideas there
Zoltán Zörgő at 30-Apr-13 6:50am
   
Than simply replace the comma with newline and make you report to enable multiline cells.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 386
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 215
3 /\jmot 189
4 Praneet Nadkar 173
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 30 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100