 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Select current statement vs Table hints |
|
Using table hints (which go hand in hand with WITH in SQL Server) will fool Select current statement into prematurely finishing selection. 'Works' both ways.
From top to bottom until meeting WITH:
From bottom upwards including WITH:

|
|
Thu Sep 14, 2017 4:32 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you for reporting this issue. I guess it finds WITH and assumes it's a beginning of CTE statement. I'm going to log this as a defect.
|
|
Fri Sep 15, 2017 9:36 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Yes, that must be the case. I recall reading somewhere that CTE's not at the beginning of the batch are required to have their WITH keyword preceded by a semicolon just because of this.
|
|
Fri Sep 15, 2017 9:40 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
As far as I know, for a top level CTE its first keyword WITH must the be first one in the script or follow GO or ; delimiters.
It's more complicated for nested CTEs
|
|
Fri Sep 15, 2017 9:46 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|