Tuesday, March 6, 2012

aggregate for strings

Any chance of getting an aggregate to combine varchar's in 08?

No. This is not planned for SQL Server 2008. You need to write your own SQLCLR aggregate or use traditional SQL techniques or xml capabilities to do the aggregation/concatenation.

|||

What specific aggregates are you interested in? There are some enhancements to the CLR user-defined aggregates in 2008 that may help you out.

Cheers,

-Isaac

|||

Ideally Sum(stringcolumn,separator) so Sum(MyColumn,':')

On the CLR:

When 05 was first released we thought that the CLR integration would be one of the best features in the product. However, once we actually tried to use it we realized that on average it was doubling the development time over T-SQL procedures/functions. The problem is that building a function in T-SQL is really easy, just load up management studio, edit the template, save and test. On the other hand building a CLR function requires at least a couple more steps if the developer has VS Pro and a lot more if they have VS Standard. This add's cost and time. This was semi alleviated by Neil's project which improved the entire CLR development experience. What needs to happen is that management studio needs to support CLR function development, with a simple one click save/deploy feature, even if it lacks full VS code functions. Likewise at the very least VS should support CLR function development directly off of the server/database explorer.

Edit: At the very least if SQL doesn't support that aggregate then RS should have one like that. Also how close are we to seeing the next CTP drop? I installed the July one on VPC then deleted it and made a new VPC to test another project. Now, I kinda want to reinstall it but I'm hesitating to because I figure that we will see a new CTP drop any day.

|||

Thanks for the feedback on CLR development. The issue of ease of developmentparticularly for what should be simple bits of code like the one we're talking about hereis one that we would like to do something about.

I don't have the date for the next CTP handy, but it's not immanentI wouldn't expect it before the end of October.

Cheers,

-Isaac

|||

Thanks you have been very helpful. We ended up using a CLR aggregate to solve our string problem. Just out of curiosity will we be able to use linq in the 08 CLR?

|||? LINQ isn't on the "short list" of .NET libraries tested and approved for direct loading in SQLCLR, if that's what you are asking. Cheers, Bob Beauchemin SQLskills ""akula"@.discussions.microsoft.com" <"=?UTF-8?B?YWt1bGE=?="@.discussions.microsoft.com> wrote in message news:8bd1a423-9adb-4b0b-9c22-0416c14805b4@.discussions.microsoft.com... Thanks you have been very helpful. We ended up using a CLR aggregate to solve our string problem. Just out of curiosity will we be able to use linq in the 08 CLR?

No comments:

Post a Comment