Book Image

What's New in SQL Server 2012

Book Image

What's New in SQL Server 2012

Overview of this book

Microsoft SQL Server has been part of the enterprise database landscape since SQL Server 7 arrived in 1998 and has evolved into the relational and BI platform of choice by businesses around the globe. The performance and full feature set of SQL Server has been widely recognized by the business community and it is viewed as a powerful weapon in their database and business intelligence arsenal. SQL Server brings numerous benefits to all businesses, central to which is a thorough understanding of the technology, both current and new.This is the book both DBAs and developers always wanted to buy but could never find in the bookstore. This is a SQL Server book that contains only the new features introduced in SQL Server 2012.This book will give you a competitive advantage by helping you to quickly learn and understand the new features of SQL Server 2012. Most readers will already have an established knowledge of SQL Server and will want to update their 2008/2008R2 knowledge swiftly with least pain.This book takes you through all of the new features of SQL Server 2012, from installing core database services and features, to the new administration and updated Transact-SQL functions. You will discover the new Analysis Services features, introduce data alerts and reporting features and explore the new enhancements to Integration Services. In addition you will learn how to automate, cleanse and transform critical business data with DQS and world-class enterprise level availability features.Finally, you will venture into simulating real-world database loads using Distributed Replay and complete your journey with a look at the new SQL Server cloud services and the new Hadoop big data platform.
Table of Contents (19 chapters)
What's New in SQL Server 2012
Credits
About the Authors
Acknowledgment
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Installing SQL Server 2012
Index

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 can see from the following result this returns the last day of the month of May:

We have written this book in a leap year which, as you know, generally only happens every four years, coinciding with the Olympics. This function removes the need to code...