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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-12-11 : 12:47:45
|
Marc writes "I have 3 tables related to this one table using foreign keys. The relationship is a 1 to many from the main table to each of the others. I want to run one stored procedure that will return all the rows from the main table as well as a column for each of the related tables with all the matching values being comma seperated in this column.
Foe example say we have a database of shoes. The main table would have the model numbers,materials and type for all the shoes. One of the "child" tables would have all the available sizes and the other table would have all the available colors.
I want to return one row that would have all the info from the shoe table AND one column that would have all the sizes comma seperated and the other column would have all the color codes.
so instead of :
MODEL SIZE COLOR tr23 12 black tr23 8.5 blue tr23 11 red
I want :
MODEL SIZE COLOR tr23 12,8.5,11 black,blue,red
I found this function in the SQL-BOL calledGetStringRange, however, this is some SQL-DMO stuff that just leaves me clueless. Maybe you can understand it. It seems to do what I want, but....
Good luck Mr. Guru.
MDM (SQL7.0 on Win2K svr)" |
|
|
|
|
|