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 |
pattonjo
Starting Member
11 Posts |
Posted - 2013-12-02 : 19:51:48
|
I have a table with column name 'Descrip'as Text. The values look something like this.1"_(1.000")_Round_6061-T6_CF_12'_(144")How can I run a query against this table to separate each given underscore and put them in different columns? 1" | (1.000") | Round | 6061-T6 | CF | 12' | (144")Thanks In Advance |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-03 : 00:18:17
|
[code]SELECT MAX(CASE WHEN f.ID = 1 THEN f.Val END) AS Part1,MAX(CASE WHEN f.ID = 2 THEN f.Val END) AS Part2,MAX(CASE WHEN f.ID = 3 THEN f.Val END) AS Part3,MAX(CASE WHEN f.ID = 4 THEN f.Val END) AS Part4,MAX(CASE WHEN f.ID = 5 THEN f.Val END) AS Part5,MAX(CASE WHEN f.ID = 6 THEN f.Val END) AS Part6,MAX(CASE WHEN f.ID = 7 THEN f.Val END) AS Part7FROM Table tCROSS APPLY dbo.ParseValues(t.Column,'_')fGROUP BY t.Column[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|