What Is CTE in Sql Server 2005 ?
shaikh shahbaz
Select an image from your device to upload
CTE (Common Table Expression) is the new and interesting feature of SQL Server 2005.Now,CTE stores the result as temporary result set from inside a statement.CTE is used when creating tables on the fly inside a nested select and doing recursive function.CTE can be used for select and DML statements.
For example:
use AdventureWorks
go
with MyCte( ListPrice , SellPrice) As
{
select ListPrice , ListPrice * .95 from Production.Product
}
select * from MyCte