No formatting options for UDF calls

HannekeHanneke Posts: 8 New member
edited February 2, 2021 3:59PM in SQL Prompt
I have installed SQL Prompt en set up a profile, but I can't find any options for how to format User defined function calls. 

I prefer the parameters to be aligned from top to bottom. Like this: 

EXEC dbo.udf
          @param1
        , @param2
        , @param3

But for now my profile only puts all the paramters behind the function call. Did I miss an option - or is it not present? And if the latter case is true, could it be developed in the future? 

Just to clarify; I know there are options for function calls, but I would actually like the SQL native calls like DATEADD to remain on one line. 

Answers


  • Thanks for reaching out to us regarding this.

    I think you should be able to achieve this by utilizing the Active Style List items options (as shown below)?



    You may also need to adjust the Comma options, as shown below:



    I hope this helps! Please do come back to us if you require any further assistance on this.
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • HannekeHanneke Posts: 8 New member
    edited February 4, 2021 12:16PM
    Good day, 

    I tried this, and I realized that the issue lies with what the code formatting recognises as lists. 

    An example - I have a call to a stored procedure which gets formatted correctly with those settings, like this:


         EXEC UTILS.dbo.Procedure
              @param1
            , @param2
            , @param3 OUTPUT
            , @param4 OUTPUT
            , @param5;

    Then later on in this same code block I have another procedure call, but it gets formatted like this:


    EXEC UTILS.dbo.Procedure2 @param1, @param2, @param3 = 0;

    So where does this difference come from? 
  • HannekeHanneke Posts: 8 New member
    I may be double posting this, but I feel like the forum ate my previous reply. 

    I tried with those settings, but I realized the issue lies with what the formatting recognizes as lists. One procedure call with parameters gets recognized as a list, another isn't. 

    Example
    This works well: 

         EXEC UTILS.dbo.Procedure
              @param1
            , @param2
            , @param3 OUTPUT
            , @param4 OUTPUT
            , @param5;


    This gets formatted on one line: 
         EXEC UTILS.dbo.Procedure2  @param1, @param2, @param3 = 0;

  • Thank you for your update on this, my sincere apology for the delay in responding to you!

    So that I can try and reproduce this at my end, would you be happy to send me a copy of of your format style?

    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • HannekeHanneke Posts: 8 New member
    Hi, 

    I attached it here as a txt file (json isn't allowed as an attachment here). I also noticed something else; If a procedure call has named paramters, it gets formatted correctly. However, if the parameters are unnamed, it gets formatted on one line. 

    I hope this helps you zoom in on the issue. 
  • Hi Hanneke,

    My apology again for the delay in updating you on this!

    Unfortunately I will need the file in a json format, and so I will reach out to you by email via a ticket I have created. You will then be able to attach the file in your reply.
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • HannekeHanneke Posts: 8 New member
    The final fix seemed to have worked, thanks! 
Sign In or Register to comment.