Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dewacorp.alliances
452 Posts |
Posted - 2010-01-03 : 18:02:26
|
| Hi thereI have 2 columns in my table called TaskSet and SkillsSelected.The sample data as follow:TaskSet | SkillsSelected;SK000001, SK000004, SK000002 | SK000001, SK000002, SK000003As you can see it's using comma to seperate the data. The query that we would like to pull is thatGive me the record that is not from the TaskSet that is not exist in the SkillsSelected so in this case will return: SK000003 for that rowI am thinking to use cursor BUt is there any alternative way?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-03 : 21:44:42
|
using a CSV parsing function like- CSVTable - fnParseListwith CROSS APPLYselect t.TaskSet, t.SkillsSelected, ss.stringvalfrom mytable t cross apply dbo.CSVTable(t.SkillsSelected) sswhere not exists ( select * from dbo.CSVTable(t.TaskSet) ts where ts.stringval = ss.stringval ) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-04 : 01:56:38
|
| Also read about NormalizationMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|