views:

92

answers:

1

I am trying to write an aggregate udf for using Sql Server 2008 and C# 3.5 that implodes an aggregation of data. The kind of syntax I am looking for is:

SELECT [dbo].[Implode]([Id], ',') FROM [dbo].[Table] GROUP BY [ForeignID]

where the second parameter is the delimiter for the aggregate function. And example return value would be something like:

1,4,56

Is there a way to have multiple parameters in an aggregate udf?

+2  A: 

In SQL 2008 Yes. For an example of one very similar to what you are doing I think see the post here http://stackoverflow.com/questions/2940183/clr-multi-param-aggregate-argument-not-in-final-output

Martin Smith
+1, you should have actually "answered" the linked question, you can't up-vote a comment!
KM