SQL Server - DECLARE and commas

10 Posts
2 Users
0 Reactions
756 Views
(@tix2garr)
Member
Joined: 3 years ago
Posts: 5
Topic starter  

I'm currently using 6.24.4.1 in Notepad++ and 6.24.03.30 (GUI)/6.24.03.22 (engine release) desktop version and they are both doing the same thing.

Prior to the last update or so, my DECLARE statement would look like:

DECLARE @SQL VARCHAR( MAX ) = ''
   , @SQL2 VARCHAR( MAX ) = ''
   , @Type VARCHAR( 6 ) = 'F0004'
   , @LinkToTable NVARCHAR( 150 ) = 'Something'
   , @LinkToColumn NVARCHAR( 150 ) = 'Something else'
   , @LinkValue NVARCHAR( 150 ) = ''
   , @Start VARCHAR( 2 ) = '6'
   , @NumChars VARCHAR( 2 ) = '6'
    

Line break before comma.

 

Now, however, it is doing this:

DECLARE @SQL VARCHAR ( MAX ) = ''                   ,
   @SQL2 VARCHAR ( MAX ) = ''                       ,
   @Type VARCHAR ( 6 ) = 'F0004'                    ,
   @LinkToTable NVARCHAR ( 150 ) = 'Something'      ,
   @LinkToColumn NVARCHAR ( 150 ) = 'Something else',
   @LinkValue NVARCHAR ( 150 ) = ''                 ,
   @Start VARCHAR ( 2 ) = '6'                       ,
   @NumChars VARCHAR ( 2 ) = '6'
 

I can't find any settings for DECLARE to "fix" it.  Everywhere I can find, I have line break before the comma.

Help, please.  ๐Ÿ™‚

Michael


   
Quote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 234
 

Dear @tix2garr,

thanks for your feedback. I will investigate

Regards

Guido


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 234
 

I found the reason for this issue.

Until now I used this option (see screenshot) to control linebreaks before/after comma for Commands like the EXEC.

grafik

Now this option is only impacting linebreaks for Parms as it is said in the Panel

I will need to add another option to control linebreak for statements

 

 


   
ReplyQuote
(@tix2garr)
Member
Joined: 3 years ago
Posts: 5
Topic starter  

I would very much appreciate that.  ๐Ÿ™‚

Interesting side note, though...  no matter what I have checked, or not checked, in the Before Comma and After Comma checkboxes, it doesn't affect the commas in the declare statement.  Wacky.  <wry smile>

Michael

This post was modified 12 months ago by Tix2garr

   
ReplyQuote
(@tix2garr)
Member
Joined: 3 years ago
Posts: 5
Topic starter  

Any update on having a new parameter to handle linebreak for statements?  ๐Ÿ™‚

 

Michael


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 234
 

Thanks for the reminder. In SQL Sever I can see 3 different statements where the comma rule would apply

grafik

Do you see any other statment where the comma linebreak rule could be applied?


   
ReplyQuote
(@tix2garr)
Member
Joined: 3 years ago
Posts: 5
Topic starter  

For SQL Server...

  • Procedure/function Parameters - CREATE PROCEDURE name @var type, @var type... AS
  • EXEC sproc var, var, var
  • INSERT INTO table (field, field...) VALUES (value, value...)
  • SELECT field, field...
  • ORDER BY field, field, ...
  • GROUP BY field, field, ...
  • My Lists...  (really like this, by the way!)
    • Some of mine:  IN, CONVERT, TRY_CONVERT, DECIMAL, IIF, ISNULL, LEFT, PATINDEX, RIGHT, SUBSTRING
  • UPDATE ... (field = , field = ...)
  • DECLARE @var type, @var type, ...
  • SET @var =, @var =, ...
    • Which can also be SELECT @var =, @var =, ...
  • CREATE TABLE name ( file type, field type, ...)

Those are the "only" ones I could think of/find.  Yes, most of the rest of them are already covered somewhere, but wanted to be as complete as I could.  ๐Ÿ™‚

There are much more specific ones like CREATE INDEX, etc., but those are a pain no matter what.  (I just put --FORMAT_OFF / --FORMAT_ON around them.  <chuckle>)

Back to you!  ๐Ÿ™‚

Michael


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 234
 

OK, thanks. First tests ran fine. I will try to improve the indentions which looks sometimes ugly, when there are only 2 vars

grafik

   
ReplyQuote
(@tix2garr)
Member
Joined: 3 years ago
Posts: 5
Topic starter  

Sounds like a plan.  Thank ya much!!  ๐Ÿ™‚

Michael


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 234
 

Hi,

the new release is available for Download with a few new options

grafik

   
ReplyQuote
Share: