Options

Not beautifull format

tcotco Posts: 9 New member
DECLARE @x BIT
  =0
       ,@r VARCHAR(MAX) =' 
-------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----  
 '

Tagged:

Best Answer

  • Options
    tcotco Posts: 9 New member
    Thanks.
    But this is not a problem to add in forum. The simple way is two DECLARE
    DECLARE @x BIT=0
    DECLARE @r VARCHAR(MAX)
      ='
    -------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----  
     '

Answers

  • Options
    Alex BAlex B Posts: 1,132 Diamond 4
    edited March 4, 2019 3:25PM
    Hi @tco,

    I'm not sure whether it's partly the formatting of the forum or not that has affected the format you've shown, but what would you like this to look like?  I think the data line is always going to be an issue, but depending on the options used, I can get this to look like:
    DECLARE
        @x BIT = 0
       ,@r VARCHAR(MAX) = '
    -------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----  
     ';
    

    Which is more orderly at the least, but may or may not be what you are looking for.  If you could share a screenshot of what you are hoping it would look like then I could help try to get it to that format.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Options
    tcotco Posts: 9 New member
    By my mind:
    DECLARE @x BIT  =0
           ,@r VARCHAR(MAX) ='
    -------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----  
     '

  • Options
    Alex BAlex B Posts: 1,132 Diamond 4
    Hi @tco,

    I'm attaching a style that accomplishes this, though it may have an effect on the format of other things that you do not want - namely because getting the first item after the declare on the same line is a global option in the Lists > List items section.

    I've had to add the .txt extension, but please remove this and place the file into your
    %LocalAppData%\Red Gate\SQL Prompt 9\StylesV2

    folder, then open the SQL Prompt > Edit Formatting styles window to be able to choose ABTestStyle.

    If that doesn't meet your requirement and/or has adverse impact on other parts of your queries, please add a suggestion to the SQL Prompt Uservoice forum for more specific functionality for your example.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
Sign In or Register to comment.