THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Peter DeBetta's SQL Programming Blog

Peter DeBetta's blog about programming in SQL Server using technologies such as T-SQL, .NET, CLR, C#, VB, Visual Studio, and SQL Server Management Studio.

T-SQL is here to stay

I just read a blog post by Adam Machanic and feel compelled to thank Adam on telling it like it is.

I 'd also like to regurgitate his comments and add a few of my own:

T-SQL is not going away.
T-SQL is still the only means of accessing data. Even integrated CLR code must use T-SQL to access data.

CLR integration is an extension to T-SQL and not a replacement.
CLR code can do some great things but it isn't meant to replace basic database abilities that are easily handled without it. For example, you will still write most, if not all of your stored procedures in T-SQL. Sure, you may make calls out to CLR-base objects in that stored procedure code (and you may not), but T-SQL will still reign king in your database. Instead, CLR code is meant for things such as custom data types, specialized constraint checking (RegEx validation always comes to mind), or specialized functions (parsing a delimited string into a table). These things are best or only doable via CLR code.

CLR code should not be used haphazardly.
You may even find that you don't need it in your particular database implementation - nothing wrong with that. But, when you do need to use it, it can really give you some additional power that T-SQL just isn't cut out for.

Business rules still belong in the business layer.
I can't stress this fact enough. Rules that apply to a particular business process and not to the data itself do not belong in the database. Rules that are always pertinent to the data, regardless of the business process using said data belong in the database. The former are business rules and the latter are data rules. Business rules belong in the business software and data rules belong with the data.

Finally, keep in mind that exceptions do occur.
And for any number of reasons, technical, political, or otherwise, you may have to put a data rule in the business layer or may be prevented from using CLR code in your database implementation.


Published Monday, June 26, 2006 12:59 PM by Peter W. DeBetta

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS


No Comments

Leave a Comment


About Peter W. DeBetta

Peter DeBetta works for Microsoft as an Application Platform Technology Strategist, specializing in strategies, design, implementation, and deployment of Microsoft SQL Server and .NET solutions. Peter writes courseware, articles, and books – most recently the title Introducing SQL Server 2008 from Microsoft Press. Peter speaks at conferences around the world, including TechEd, SQL PASS Community Summit, DevTeach, SQL Connections, DevWeek, and VSLive!

When Peter isn’t working, you can find him singing and playing guitar (click here to hear an original song by Peter), taking pictures, or simply enjoying life with his wife, son, and daughter.
Privacy Statement