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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 like a user defined aggregate function for concate

Author  Topic 

Cornelius19
Starting Member

30 Posts

Posted - 2008-05-08 : 18:44:24
Hi,

I have a table T1 with two fields. Field1 has repeated values and Field2 has unique values for any given Field1 value. F1 can have maybe 1000 different values while F2 maybe 20.

I would like to create a T2 table where Field1 has unique values and Field2 contains the concatenation of T1.Field1 values for each Field1 value.

T1
F1 F2
1 a
1 b
2 a
2 c
2 d

T2
F1 F2
1 ab
2 acd

It is like a user defined aggregate function for concatenation. Any idea?

Cornelius

karuna
Aged Yak Warrior

582 Posts

Posted - 2008-05-08 : 19:08:51
Check this out

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254

Thanks
Karunakaran
Go to Top of Page

Cornelius19
Starting Member

30 Posts

Posted - 2008-05-09 : 11:38:59
Thanks a lot. The suggestion on 81254 did not work (I guess simply because I have SQL Server 2000) but it had a link to 56058 and tocroi72’s code on 56058 worked fine. It is resolved now.

Cornelius
Go to Top of Page
   

- Advertisement -