Table Variables formatted with schema settings
DaveB
Posts: 11
When I enable the Schema statements settings:
New Line on Open parenthesis of a definition
New Line on First definition
New Line on Closing parenthesis of a definition
and then format a stored procedure with a table variable, the table variable is formatted using the above settings.
After formatting
I don't believe that the table definition should be aligned to the left hand column like the procedure parameters. Instead I would have expected this:
I've tried the Indent definition option but I prefer not to indent parenthesis.
Tested using SQL Prompt 5.0.1.7 and 5.1 beta.
New Line on Open parenthesis of a definition
New Line on First definition
New Line on Closing parenthesis of a definition
and then format a stored procedure with a table variable, the table variable is formatted using the above settings.
CREATE PROCEDURE dbo.Test1 ( @param1 INT , @param2 INT ) AS BEGIN DECLARE @temp1 TABLE ( col1 INT, col2 INT, col3 INT, col4 INT ) SELECT * FROM @temp1 AS t1 WHERE t1.col1 = @param1 AND t1.col2 = @parm2 END GO
After formatting
CREATE PROCEDURE dbo.Test1 ( @param1 INT , @param2 INT ) AS BEGIN DECLARE @temp1 TABLE ( col1 INT , col2 INT , col3 INT , col4 INT ) SELECT * FROM @temp1 AS t1 WHERE t1.col1 = @param1 AND t1.col2 = @parm2 END GO
I don't believe that the table definition should be aligned to the left hand column like the procedure parameters. Instead I would have expected this:
CREATE PROCEDURE dbo.Test1 ( @param1 INT , @param2 INT ) AS BEGIN DECLARE @temp1 TABLE ( col1 INT , col2 INT , col3 INT , col4 INT ) SELECT * FROM @temp1 AS t1 WHERE t1.col1 = @param1 AND t1.col2 = @parm2 END GO
I've tried the Indent definition option but I prefer not to indent parenthesis.
Tested using SQL Prompt 5.0.1.7 and 5.1 beta.
Comments
Can you try reformatting after selecting the option 'Indent Definition' child option of 'First Definition'?
Does that make any difference?
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
I think that table variables and function / procedure definitions need to be handled via separate formatting settings.
Thanks for the response.
-Dave