SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[9.2.349 PRO] WITH EXECUTE

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[9.2.349 PRO] WITH EXECUTE
Author Message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post [9.2.349 PRO] WITH EXECUTE Reply with quote
Is there a particular reason:

Code:
WITH EXECUTE AS CALLER
AS


ends up as:

Code:
WITH

EXECUTE AS CALLER
        AS


I would imagine it's lining up the AS because it thinks it's lining aliases up? But why is it separating WITH from WITH EXECUTE?


My code formatting with rule is the default:


Code:

WITH ...


But even if I disable the default WITH formatting rule, it still does it.

I've also tried the default TSQL rules and it does it as well, so I don't think it's anything I've changed?
Tue Sep 26, 2017 12:09 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
It appears it takes a:

"CREATE PROCEDURE" or "ALTER PROCEDURE" to trigger this OR having the 'exec' and 'execute' formatting rules enabled.

If I type WITH EXECUTE AS CALLER alone in an editor window with exec/execute formatting rules OFF, it stays as typed.

BUT

If I add an alter/create procedure line before the WITH.. then the alter or create formatting rules take over and it still wraps down even though the rules appear as if it should continue the WITH statement on the first line?
Tue Sep 26, 2017 3:02 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
Ah... it's got to do with my commas setting.. stacked and leading seems to be doing it... but there are no commas in the with statement so there's still something there?
Tue Sep 26, 2017 3:10 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6506

Post Reply with quote
I think this is indeed caused by the collision of formatting rules

The default rule for ALTER PROCEDURE is

Code:
ALTER PROCEDURE ...
   @...
   @...
WITH ..., ...
AS
   <stmtList>
GO

Note the pattern WITH ...,...

which conflicts with commas rules

If you change the above to

Code:
ALTER PROCEDURE ...
   @...
   @...
WITH ...
AS
   <stmtList>
GO



then it won't do that
Wed Sep 27, 2017 12:38 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6506

Post Reply with quote
Actually, I take it back, there is also conflicting [AS] which appears in the WITH...AS... clause and the formatter finds it before AS for procedure. The rule should be hardened somehow, I'm not yet sure yet how because WITH may or may not have the following AS in the clause
Wed Sep 27, 2017 12:46 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6506

Post Reply with quote
I submitted a ticket for this issue under #SA0032247
Wed Sep 27, 2017 12:51 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.