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

SEQUENCE


You are no doubt used to IDENTITY and how this works with a seed and increment value. SEQUENCE is structured in a very similar way, but with fewr limitations, giving it a welcome flexibility.

A SEQUENCE object is created at the database level but, unlike an IDENTITY property, it can be used across multiple tables. An IDENTITY value is generated when you insert a row into a table and it cannot be updated. You can retrieve the SEQUENCE value at any time and reset it without altering its previous value, and even set a minimum and maximum value. Let us look at a simple example:

CREATE SEQUENCE mySequence AS int
START WITH 1
INCREMENT BY 1

As you can see, mySequence is now available for use by all tables in the database:

We have not used the SEQUENCE object yet, so the first value returned should be 1. Run the following statement to confirm this:

SELECT NEXT VALUE FOR mySequence AS [Next Value]

We can see that the SEQUENCE has not been used:

Next we will create a table so we can put SEQUENCE...