Skip to Content
What's New in SQL Server 2012
book

What's New in SQL Server 2012

by Rachel Horder
October 2012
Intermediate to advanced
238 pages
5h 17m
English
Packt Publishing
Content preview from What's New in SQL Server 2012

Datetime functions

New functions that make datetime variables easier to handle are always welcome. With SQL Server 2012 there are a number of new functions that we think will really make your programming life much easier. We will explore a number of examples so you can quickly understand how to use them in your everydy code.

EOMONTH

Firstly we will start with the end of month function or, more specifically, EOMONTH, as you will soon learn. This function does exactly what it says, returning the last day of the month you specify. This will no doubt come as a pleasant addition to anyone who runs financial calculations. The syntax is as follows:

DECLARE @MyDate datetime
SET @MyDate = '05/17/2012'
SELECT EOMONTH (@MyDate) AS LastDayOfTheMonth

As you ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein
Pro SQL Server 2012 Practices

Pro SQL Server 2012 Practices

Bradley Ball, TJay Belt, Glenn Berry, Jes Borland, Carlos Bossy, Louis Davidson, Ben DeBow, Grant Fritchey, Jonathan Gardner, Jesper Johansen, Jeremy Lowell, Wendy Pastrick, Kellyn Pot'vin, Mladen Prajdić, Herve Roggero, Chris Shaw, Gail Shaw, Jason Strate
Microsoft® SQL Server 2005 Unleashed

Microsoft® SQL Server 2005 Unleashed

Ray Rankins, Paul Bertucci, Chris Gallelli, Alex T. Silverstein, Tudor Trufinescu, John Kane

Publisher Resources

ISBN: 9781849687348Other