SQL SERVER – 2012 – Summary of All the Analytic Functions – MSDN and SQLAuthority

SQL Server 2012 (RC0 Available here) has introduced new analytic functions. These functions were long awaited and I am glad that they are now here. Before when any of this function was needed, people used to write long T-SQL code to simulate these functions. But now there’s no need of doing so. Having available native function also helps performance as well readability.

In the last few days I have written many articles on this subject on my blog. The goal was to make these complex analytic functions easy to understand and make them widely accepted. As these new functions are available and as awareness spreads about them, we should start using these new functions. Here is a quick list of the new functions and relevant MSDN sites:

Function SQLAuthority MSDN
CUME_DIST CUME_DIST CUME_DIST
FIRST_VALUE FIRST_VALUE FIRST_VALUE
LAST_VALUE LAST_VALUE LAST_VALUE
LEAD LEAD LEAD
LAG LAG LAG
PERCENTILE_CONT PERCENTILE_CONT PERCENTILE_CONT
PERCENTILE_DISC PERCENTILE_DISC PERCENTILE_DISC
PERCENT_RANK PERCENT_RANK PERCENT_RANK

I also enjoyed three different puzzles during the course of this series which gave a clear idea to the SQL Server 2012 analytic functions.

This series will always be my dear series as during this series I had went through a very unique experience of my book going out of stock and becoming available after 48 hours.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

About these ads

8 thoughts on “SQL SERVER – 2012 – Summary of All the Analytic Functions – MSDN and SQLAuthority

  1. Pingback: SQL SERVER – Solution to Puzzle – Simulate LEAD() and LAG() without Using SQL Server 2012 Analytic Function « Journey to SQLAuthority

  2. Pingback: SQL SERVER – Detecting Leap Year in T-SQL using SQL Server 2012 – IIF, EOMONTH and CONCAT Function « SQL Server Journey with SQL Authority

  3. hi sir i want to know how to count coloumns reapting the same values in table please help me out its attendence table and i want to count number of leave,prestent ,casual leave and all

    Like

  4. Hello Pinal,

    There is a commercial product which provides hundreds of analytic functions for SQL Server 2005, 2008 and 2012 – financial, statistical, mathematical etc. They are implemented as .NET SQL-CLR functions (permission level:safe), modeled mainly after the analytic functions found in Excel, but also from those found in R, Matlab, and Bloomberg.

    It is called XLeratorDB and can be found at westclintech.com

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s