|
SQL Server 2005 and the Death of T-SQL -
George Wesolowski
"The
reports of my death are premature" - Mark
Twain
Introduction
Recently, a number of our
clients have asked us about SQL Server 2005 and its highly-touted
Common Language Runtime (CLR) support. Based on many
of these conversations, there appears to be significant
misinformation surrounding this next version of SQL Server.
This article will address the most commonly-asked questions and
concerns.
I have a significant
investment in T-SQL. Will my existing stored procedures continue to
work?
Yes. All existing stored procedures written
in T-SQL will continue to work as they always have. There is no
need to scrap any existing stored procedure and rewrite it in C#
or VB.NET. In fact, Microsoft is currently planning on shipping
SQL Server 2005 with CLR
support disabled out of the box. Thus,
unless you explicitly enable CLR support through the clr_enabled advanced configuration
option, T-SQL will continue to be your primary option
for writing stored procedures by default.
Is Microsoft migrating away from
T-SQL?
No. As SQL Server 2005 continues
to be a relational database, SQL continues to be the industry
standard language for data retrieval and manipulation. In fact,
Microsoft is adding several enhancements to the T-SQL
language in SQL Server 2005. CLR support has been added
to extend SQL Server’s functionality, not to do away
with
T-SQL.
Do I need to learn C# or VB.NET to write
stored procedures?
It depends. You can continue to
write all your stored procedures in T-SQL. However,
CLR support will allow you to write many stored procedures more easily
using your favorite CLR-compliant language such as C# or VB.NET. If
you are adept at coding and debugging T-SQL but have no
experience with C# or VB.NET, you’ll discover the syntax is
not much more difficult to learn than T-SQL.
When should I write stored procedures
with C# or VB.NET?
You should use C# or VB.NET to
replace extended stored procedures, mathematical calculations, and
complex business logic. If your stored procedures contain
conditional or looping T-SQL structures, they can be more easily
written and debugged in C# or VB.NET. In addition, stored procedures written
in C# or VB.NET have a performance advantage over T-SQL since
they are compiled and not interpreted.
When should I write stored procedures
with T-SQL?
You should continue to use T-SQL
for common data access operations
such as retrieving data using SELECT statements, adding and updating data using
INSERT and UPDATE statements, and purging data using DELETE statements. Because these
statements make up the “pure SQL” part of the T-SQL
language that has been industry standard for decades, they will continue
to be the preferred choice for performing data access
and manipulation.
Summary
Moving to SQL Server 2005 is a
win-win situation. Your existing stored procedures will continue
to work as-is. T-SQL as we know it will continue to be the
language of choice for performing data access and data
manipulation operations. And, newly-added support for the CLR will
allow you perform complex business logic and mathematical
calculations more easily using C# or VB.NET. By taking advantage
of the features of both T-SQL and the CLR, you’ll be able to
more rapidly deploy future SQL Server applications while your
existing applications continue to run without any
modifications.
|