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

A Simple Introduction to Cisco CML2

0 3774 0

Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2

Cable Testers and How to Use them in Network Environments

0 692 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Government Edition – Encrypting a USB Flash Drive in Windows 10

0 270 2

In this video, Security Instructor Mike Danseglio demonstrates how to use BitLocker in Window 10 to secure files on a USB Flash drive that adhere to stricter data protection requirements as found inside Government entities. BitLocker 2-day instructor-led training is now available at Interface: BITLOCK: Planning and Deploying BitLocker Drive Encryption Training Video Transcription: Hi. … Continue reading Government Edition – Encrypting a USB Flash Drive in Windows 10

Write a Comment

Share your thoughts...

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