EOMONTH () Function in SQL Server Denali

by Amol 22. September 2011 09:52

SQL Server Denali introduced new function EOMONTH() to calculate End Of Month date

SELECT EOMONTH (GETDATE()) LastDayOfMonth  -- Will return last day of the month

LastDayOfMonth
-------------------------
2011-09-30 00:00:00.000

In earlier version we need to many date time function to the last day of the month.

Tags: , ,

General

CHOOSE() function in SQL Server Denali

by Amol 22. September 2011 09:30

SQL Server Denali introduces some cool function which makes programming easy. Let's take an example of new function CHOOSE() which is introduced in SQL Server Denali

CHOOSE() fuction will returns a value from a given array of values based on specified Index.

SELECT CHOOSE(MONTH(GETDATE()), 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')

 Above statement will return the Month Name based on Month Number. 

Tags: ,

General

Category

Recent Posts

Tag cloud