Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 what is CTE?

Author  Topic 

ibn-al-haytam
Starting Member

5 Posts

Posted - 2010-09-30 : 05:36:29
hello everybody
i'm new to SQL Server and i encountered a new termes that i didn't understand namely CTE,can someone please tell me what CTE means
thanks for help,sorry for inconveniences

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-09-30 : 05:40:26
why don't you read the manual?

open microsoft server managment stuido.

Go to Help (press F1) then index.

and search for CTE

The documentation for sql server is excellent. Here's what the entry starts with:
quote:


A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

A CTE can be used to:



Basically think of it as an inline view (except better as it can use variables / recursion ) that only exists for the scope of one statement.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -