T-SQL Code or Managed Code?

When writing stored procedures, triggers, and user-defined functions (UDFs), one decision that database programmers will now have to make is whether to use traditional T-SQL or a .NET language such as Visual Basic .NET (VB.NET) or C#. The answer depends upon the particular situation.

T-SQL is best used in situations where the code will mostly perform data access with little or no procedural logic. Managed code is best suited for CPU-intensive functions and procedures that feature complex logic or when you want to leverage the .NET Framework's Base Class Library.

Code placement is another important factor to consider. Both T-SQL and in-process managed code can be run on the server.This functionality places code and data close together, and allows you to take advantage of the processing power of the server machine. On the other hand, you might wish to avoid placing processor-intensive tasks on your database server. Most client machines today are powerful, and you might wish to take advantage of this processing power by placing as much code as possible on the client.Although T-SQL code can't run on a client machine, the SQL Server in-process provider was designed to be as similar as possible to client-side managed ADO.NET, enhancing the portability of code between server and client.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Michael Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 21, 2013
blog

A Common Misconception about MAXDOP

Out of the box, SQL Server is (and has been) able to take advantage of multiple processors/cores without any effort on behalf of administrators....More
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.