SQL SERVER – Function: Is Function – SQL in Sixty Seconds #004 – Video

Posted by pinaldave on SQL Authority See other posts from SQL Authority or by pinaldave
Published on Wed, 29 Feb 2012 01:30:51 +0000 Indexed on 2012/03/18 18:10 UTC
Read the original article Hit count: 572

Today is February 29th. An unique date which we only get to observe once every four year. Year 2012 is leap year and SQL Server 2012 is also releasing this year. Yesterday I wrote an article where we have seen observed how using four different function we can create another function which can accurately validate if any year is leap year or not. We will use three functions newly introduced in SQL Server 2012 and demonstrate how we can find if any year is leap year or not.

This function uses three of the SQL Server 2012 functions - IIF, EOMONTH and CONCAT. When I wrote this function, this is the sortest function I ever wrote to find out leap year. Please watch the video and let me know if any shorter function can be written to find leap year.

More on Leap Yer:
Detecting Leap Year in T-SQL using SQL Server 2012 – IIF, EOMONTH and CONCAT Function
Date and Time Functions – EOMONTH() – A Quick Introduction
Script/Function to Find Last Day of Month 

I encourage you to submit your ideas for SQL in Sixty Seconds. We will try to accommodate as many as we can.

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


Filed under: Database, Pinal Dave, PostADay, SQL, SQL Authority, SQL in Sixty Seconds, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Video

© SQL Authority or respective owner

Related posts about Pinal Dave

Related posts about PostADay