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 |
|
ygeorge
Yak Posting Veteran
68 Posts |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-06-28 : 16:29:01
|
[code]Create Table myTable99 (imageId int, inventoryId int, PhotoUrl varchar(100))Insert Into myTable99 Select 1, 1, 'http://myimageserver/imageName1_1.jpg' Union AllSelect 2, 1, 'http://myimageserver/imageName1_2.jpg' Union AllSelect 3, 1, 'http://myimageserver/imageName1_3.jpg' Union AllSelect 4, 2, 'http://myimageserver/imageName2_1.jpg' Union AllSelect 5, 2, 'http://myimageserver/imageName2_2.jpg'gocreate function dbo.getInventoryPhotos(@inventoryId int)Returns varchar(8000) AsBegin Declare @photoList varchar(8000) Select @photoList = isnull(@photoList+',','') + photoUrl From myTable99 Where inventoryId=@inventoryId Return(@photoList)EndgoSelect distinct inventoryId, dbo.getInventoryPhotos(inventoryId)From myTable99goDrop Table myTable99goDrop function dbo.getInventoryPhotos [/code]Corey Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now." |
 |
|
|
ygeorge
Yak Posting Veteran
68 Posts |
Posted - 2005-06-28 : 16:33:14
|
| Very cool. Thanks a lot.George |
 |
|
|
|
|
|
|
|