SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Select current statement vs Table hints

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Select current statement vs Table hints
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Select current statement vs Table hints Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7841

Post Reply with quote
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7841

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.