Datasheet

3
Chapter 1: Introducing T-SQL and Data Management Systems
the system, the number of transactions and code executions increased exponentially. It wasn ’ t long
before inefficient code began to consume all the available CPU resources. This is the trap of writing
expedient code instead of efficient code. Another of my father s favorite sayings is Why is there never
enough time to do the job right, but plenty of time to do it twice? This book tries to show you the best
way to write T - SQL so that you can avoid writing code that will bring your server to its knees, begging
for mercy. Don t give in to the temptation to write sloppy code just because it is a one time deal. I have
seen far too many times when that one - off ad - hoc query became a central piece of an application ’ s
business logic.
What s New in SQL Server 2008
When SQL Server 2005 was released, it had been five years since the previous release and the changes to
the product since the release of SQL Server 2000 were myriad and significant. Several books and
hundreds of websites were published that were devoted to the topic of What s New in SQL Server 2005.
With the release of SQL Server 2008, however, there is much less buzz and not such a dramatic change
to the platform. However, the changes in the 2008 release are still very exciting and introduce many
changes that T - SQL and application developers have been clamoring for. Since these changes are
sprinkled throughout the capabilities of SQL Server, I won t spend a great deal of time describing all the
changes here. Instead, throughout the book I will identify those changes that are applicable to the subject
being described. In this introductory chapter I want to quickly mention two of the significant changes to
SQL that will invariably have an impact on the SQL programmer: the incorporation of the .NET
Framework with SQL Server and the introduction of Microsoft Language Integrated Query (LINQ).
Kiss T - SQL Goodbye?
I have been hearing for years that T - SQL and its ANSI counterpart, SQL, were antiquated languages and
would soon be phased out. However, every database vendor, both small and large, has devoted millions
of dollars to improving their version of this versatile language. Why would they do that if it were a dead
language? The simple fact of the matter is that databases are built and optimized for the set - based
operations that the SQL language offers. Is there a better way to access and manipulate data? Probably so,
but with every major industry storing their data in relational databases, the reign of SQL is far from over.
I worked for a great guy at a Microsoft partner company who was contracted by Microsoft to develop
and deliver a number of SQL Server and Visual Studio evangelism presentations. Having a background
in radio sales and marketing, he came up with a cool tagline about SQL Server and the .NET Framework
that said SQL Server and .NET Kiss T - SQL Goodbye. He was quickly dissuaded by his team when
presented with the facts. However, Todd wasn t completely wrong. What his catchy tagline could have
said and been accurate was SQL Server and .NET Kiss Inefficient, CPU - Hogging T - SQL Code
Goodbye. ”
Two significant improvements in data access over the last two releases of SQL Server have offered fuel
for the SQL is dead fire. As I mentioned briefly before, these are the incorporation of the .NET
Framework and the development of LINQ. LINQ is Microsoft s latest application data - access technology.
It enables Visual Basic and C# applications to use set - oriented queries that are developed in C# or VB,
rather than requiring that the queries be written in T - SQL. Building in the .NET Framework to the SQL
Server engine enables developers to create SQL Server programming objects such as stored procedures,
functions, and aggregates using any .NET language and compiling them into Common Language
Runtime (CLR) assemblies that can be referenced directly by the database engine.
CH001.indd 3CH001.indd 3 3/26/10 11:35:34 AM3/26/10 11:35:34 AM