make a Comma separated Sting of all ID in table

  • i have one detail table having field as id,date,UID,coid

    at the end of the day i want to make sum of this table and put into another table as ID,GroupUID,dt where GroupUID will be group of comma seperated UIDs

    How should i go about it,how to collect all UID depend on date and make it into one comma separated Sting in SP or is there any way out

    any help will be appreciated

  • As a starting point, the following code produces a csv string of the IDs from the selected Adventureworks table:

    use AdventureWorks

    select stuff((select ',' + cast(ContactID as varchar) from person.contact FOR XML PATH('')),1,1,'' )

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply