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 |
abhit_kumar
Posting Yak Master
147 Posts |
Posted - 2012-04-03 : 07:42:41
|
Dear All Experts,Currently in one of table field "Pay ID" have the data like in below patterns.1,3,548,693,51,511,12Now for every above number there is specific description, now i want to change the description from number like:-1,3,5 = Good, Better, Best9 = Like3,5=Better,BestPlease guide me how to do this.Regards,Avijit |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-03 : 09:05:39
|
do you have another table that translate the value to description ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
abhit_kumar
Posting Yak Master
147 Posts |
Posted - 2012-04-03 : 11:02:12
|
Yes, i have.How to do it? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-03 : 12:11:46
|
[code];with cte as( select t1.PayID, c.stringval, t2.PayDesc from tbl1 t1 cross apply CSVTable(t1.PayID) c inner join tbl2 t2 on c.stringval = t2.PayID)select c.PayID, Descrip = stuff(( select ',' + PayDesc from cte x where x.PayID = c.PayID for xml path('') ), 1, 1, '')from cte cgroup by c.PayID[/code]get CSVTable from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=CSVTable KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|