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 |
|
Adr
Starting Member
4 Posts |
Posted - 2011-03-10 : 05:14:43
|
| Hi!I have a table alike the following one, with 4 columns Location, Type, Klass and Category_1.Location / Type / Klass / Category_1P4 / 2 / LK / AP4 / 4 / LK / AP4 / 7 / LK / BP4 / 4 / LK / D P6 / 2 / GF / A P6 / 9 / GF / CP6 / 4 / GF / CP7 / 4 / LK / DAnd I would like to create the following table out of it:Location / Klass / Category_2P4 / LK / ABDP6 / GF / ACP7 / LK / DThat is to say, to create category_2 names by combining the single characters of category_1 but to account for the duplicate letters only once when some rows have the same location and same category_1.My tables are quite big so I need to do it automatically. Could anybody give me advices on how to achieve that? I'm trying to get started with SQL.Thanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-10 : 05:39:45
|
are you using SQL 2005 / 2008 ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Adr
Starting Member
4 Posts |
Posted - 2011-03-10 : 05:43:58
|
| I am using SQL 2008. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
Adr
Starting Member
4 Posts |
Posted - 2011-03-10 : 11:03:30
|
| Thank you it was exactly what I needed.Is it usual that it takes such a long time? I used the first method described on the page and it takes around 500s for a 100 rows table. Then I don't know why I can execute the query as a function but when I want to use it in a view, I get an error message that timeout expired. |
 |
|
|
|
|
|