Data Warehousing and Business Intelligence

20 May 2011

LINQ2SQL and TSQL and CLR

Filed under: SQL Server — Vincent Rainardi @ 10:33 pm

Somebody just asked me today about the differences between LINQ 2 SQL, TSQL and CLR. I thought I’d post my short answer as it might be useful for other people.

Language Integrated Query, or LINQ is an application-oriented database query language, for example:

var q =
from c in db.Customers
where c.City == “London”
select c;
(source: http://msdn.microsoft.com/en-us/library/bb425822.aspx)

SQL is a row-oriented database query language, for example:
select * from Customers where City = ‘London’

TSQL is the Microsoft version of SQL, PL/SQL is the Oracle version, NZSQL is the Netezza version.

LINQ is good for application-database integration, but the problem is: databases accept SQL language, they don’t accept LINQ.
LINQ 2 SQL is a tool where developer can write LINQ in their application, and this tool will translate it into SQL automatically so that the database can accept it. The output from the database (rows) is then translated back to LINQ Objects.

A Stored Procedure is a collection of SQL queries e.g. TSQL, PL/SQL, NZSQL.
CLR is a way of writing Stored Procedure using application-oriented languages such as C#, C++ and VB.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: