SQL Server with Mr. Denny:

CTE

1

May 4, 2009  11:00 AM

How can I remove duplicate records in my tables?



Posted by: Denny Cherry
CTE, DELETE statement, SQL Server 2005, SQL Server 2008, T/SQL

All to often we end up with duplicate rows in a table.  The best way to keep duplicate rows out of the database is to not let them in.  But assume that they are there.  This bit of sample code shows how to delete those duplicate rows quickly and easily in a single statement.  No temp tables...

March 17, 2008  11:00 AM

Back To Basics: Using Common Table Expressions



Posted by: Denny Cherry
Back To Basics, Common Table Expressions, CTE, SQL, SQL Server 2005, SQL Server 2008, T/SQL

CTEs (Common Table Expressions) are one of the very cool features introduced in SQL Server 2005.  In there simplest most common form, think of them as a temporary single use view who's context is only within the command which follows them directly.  The syntax of a CTE is very...


December 10, 2007  8:00 AM

Temp Tables, Table Variables, and CTEs



Posted by: Denny Cherry
CTE, SQL, T/SQL, Table Variables, Temp Tables

There are some major differences between temp tables, table variables and common table expressions (CTEs).  Some of the big differences are: Temp Tables vs. Table Variables

  1. SQL Server does not place locks on table variables when the table variables are used.
  2. Temp tables...


1