Tweeted twitter.com/#!/StackDBAs/status/177224638340927488
2 grammar
source | link

fromFrom msdn :

Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

ImI'm using CTECTEs quite a lot., but I've never thought deeply about :

my question2 : the benefits of using them.

When im doingIf I reference a CTE multiple referencing using CTe , times in the same query:

  • Is there any performance benefit ?

    Is there any performance benefit?
  • if im doing Self join , will it scan it twice ?

    If I'm doing a self join, will SQL Server scan the target tables twice?

from msdn :

Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

Im using CTE quite a lot. but never thought deeply about :

my question2 :

When im doing multiple referencing using CTe ,

  • Is there any performance benefit ?

  • if im doing Self join , will it scan it twice ?

From msdn :

Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

I'm using CTEs quite a lot, but I've never thought deeply about the benefits of using them.

If I reference a CTE multiple times in the same query:

  • Is there any performance benefit?
  • If I'm doing a self join, will SQL Server scan the target tables twice?
    Post Migrated Here from stackoverflow.com
1
source | link

Common Table Expression (CTE) benefits?

from msdn :

Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

Im using CTE quite a lot. but never thought deeply about :

my question2 :

When im doing multiple referencing using CTe ,

  • Is there any performance benefit ?

  • if im doing Self join , will it scan it twice ?