Using SQL Server 2005 CLR Features to Create Aggregates

Home > Blogs > Developer Visual Studio / ASP.NET > Using SQL Server 2005 CLR Features to Create Aggregates

Using SQL Server 2005 CLR Features to Create Aggregates

Like This Blog 0 Dan Wahlin
Added by September 27, 2006

I played around with SQL Server 2005 a bit this past week to explore (more in-depth) some of the different CLR features that are available.  I'll be posting a few of the things I've experimented with over the next few days.  One thing that can be really useful is the ability to create custom aggregate functions using C# or VB.NET, store them in the database and then use them within queries or stored procedures.

Jeff Jones (a SQL Server guru teaching at Interface Technical Training) and I were talking about the new Pivot functionality and how it was fairly painful to create the list of values to pivot on using pure T-SQL.  It can definitely be done, but is a bit "hacky" IMHO.  For example, the following query (which Jeff shared with me) could be used to dynamically grab the values to use as pivot columns.  The query relies upon XPath capabilities of SQL Server to create a list similar to "[2004],[2005],[2006]" and then uses that list in a pivot statement.

 

SQL Server 2005's CLR capabilities can definitely help simplify code and make it easier to do string manipulations plus much more.  I'll post some examples of using CLR functionality to grab RSS feeds from within SQL Server soon.  Thanks to Jeff Jones for sharing the original pivot example with me.

Videos You May Like

Agile Methodology in Project Management

0 184 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

An Overview of Office 365 – Administration Portal and Admin Center

0 950 3

This is part 1 of our 5-part Office 365 free training course. In this Office 365 training video, instructor Spike Xavier introduces some of the most popular services found in Microsoft Office 365 including the Admin Portal and Admin Center. For instructor-led Office 365 training classes, see our course schedule: Spike Xavier SharePoint Instructor – … Continue reading An Overview of Office 365 – Administration Portal and Admin Center

Creating Users and Managing Passwords in Microsoft Office 365

0 795 4

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.