| Author |
Topic |
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-16 : 21:19:24
|
| I have a table where primary key is a combination of two columns(customerno & cur) and has records as follows,customerno cur bank3671079 AUD HONGKONG BANKING CORPORATION LIMITED, THE AUD 3671079 EUR HONGKONG BANKING CORPORATION LIMITED, THE3671079 USD SHANGHAI BANKING CORPORATION LIMITED, THEAnd when I join columns customerno & bank of this with another table where customerno alone is the pirmary key, i get all the above 3 records. Is it possible to put all these 3 records into one, just like below?customerno bank3671079 HONGKONG BANKING CORPORATION LIMITED, THE AUD HONGKONG BANKING CORPORATION LIMITED, THE SHANGHAI BANKING CORPORATION LIMITED, THEThis problem is really troubling me and any advice regarding this is highly appreciated.Thanking youSamindaras |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-16 : 22:01:38
|
| Khtn,Thanks a lot for your prompt reply. I just copy-paste the SQL2005/2008 solution, BUT its giving syntaxt erros near FOR & XMl. Thanking yousamindaras |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-16 : 22:10:05
|
you are using SQL Server 2005 / 2008 ? What is the compatibility level ? Is it 90 / 100 ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-16 : 22:43:53
|
| I am using sql server 2005I dont know how to check compatibility level.thankssamindaras |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-16 : 22:48:05
|
[code]sp_dbcmptlevel 'database_name'[/code]you need compatibility level 90 and above to use the "FOR XML". If yours is already at 90, post your query here, we will have a look at it KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-16 : 22:57:24
|
| khtan,database level is 80. Thats why FOR XML didnt work in the first place. Any other way to achive this ?thanking yousaminda |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-16 : 23:11:56
|
one way is to change to compatibility level 90 or use the SQL 2000 method. See the other link that i posted KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-16 : 23:55:30
|
| Khtan,Thanks a lot. I will check whether I have the right to change compatibility. BTW, I do not have access to SQL 2000.samindaras |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-17 : 00:00:54
|
quote: I will check whether I have the right to change compatibility
I hope this is not a production / live system. You should perform more testing on your application before doing that.quote: I do not have access to SQL 2000.
You can also use the SQL 2000 method (UDF method) on SQL 2005. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
saminda
Starting Member
10 Posts |
Posted - 2009-07-17 : 03:40:13
|
| khtan, I tried the SQL 2000 one, but got an error saying "ROW_NUMBER' is not a recognized function name."thanking yousaminda |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|