 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
[9.2.349 PRO] WITH EXECUTE |
|
Is there a particular reason:
 |
 |
WITH EXECUTE AS CALLER
AS |
ends up as:
 |
 |
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:
 |
 |
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 |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
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 |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I think this is indeed caused by the collision of formatting rules
The default rule for ALTER PROCEDURE is
 |
 |
ALTER PROCEDURE ...
@...
@...
WITH ..., ...
AS
<stmtList>
GO
|
Note the pattern WITH ...,...
which conflicts with commas rules
If you change the above to
 |
 |
ALTER PROCEDURE ...
@...
@...
WITH ...
AS
<stmtList>
GO |
then it won't do that
|
|
Wed Sep 27, 2017 12:38 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I submitted a ticket for this issue under #SA0032247
|
|
Wed Sep 27, 2017 12:51 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
|
|
|