[dba-SQLServer] SQL Question

Arthur Fuller artful at rogers.com
Thu May 20 18:08:14 CDT 2004


If you haven't yet an answer to this, I have a function that gathers and
concatenates the rows matching a particlar foreign key, which looks like
what you need. I published it as a SQL Tip a while back on the
builder.com site but if you still need it msg me and I'll fire you a
copy.

Arthur

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Martin
Reid
Sent: Thursday, April 22, 2004 3:58 AM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] SQL Question


Given a one to many relationship is it possible to produce this output
using an SP without the use of cursors etc??

 INPUT TABLE 1

      1000
     IT

      1000
     Databases

      1000
     VMS

      1001
     Spreadsheets

      1001
     GenStat

      1002
     Aquatic systems

      1002
     Research




INPUT TABLE 2



      1000
     Smith

      1001
     Brown

      1002
     Foster




 OUTPUT REQUIRED

      1000
     Smith
     IT, Databases,VMS

      1001
     Brown
     Spreadsheets,GenStat

      1002
     Foster
     Aquatic Systems,Research




Martin

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list