How can we help you today? How can we help you today?

Brackets when scripting stored procedures

Is there any way to disable adding brackets around the database, schema, and stored procedure name when scripting a stored procedure? SQL Prompt is adding it in, even though the stored procedure itself doesn't have them, as showed in sys.sql_modules.

Scripting an SP:
jwt2wjej83bn.png

sys.sql_modules:
wyo88gue612p.png
ggeier
0

Comments

5 comments

  • way0utwest
    This isn't SQL Prompt, at least, not necessarily. If you right click a procedure and choose script, you get SSMS defaults. If I do that, I get this:
    lq7f5vt9a5x1.jpg

    If I then reformat with SQL Prompt (CTRL+K, y), I get this:
    b063xvea3mcp.jpg

    I have my formatting set to not use extra brackets
    zcwestrmwdki.jpg

    way0utwest
    0
  • ggeier
    You're right, I just tested this by uninstalling SQL Prompt. I feel bad for accusing SQL Prompt for a crime that it didn't commit. :(

    Is there any way to have SQL Prompt automatically remove brackets in the database/schema/object name when scripting objects? I know I can use shortcuts like "ctrl+BB", but if it could do it automatically it'd make me very, very happy.
    ggeier
    0
  • krzysztofkroczak
    Hi @ggeier,

    There isn't a way to do this at the moment, I'm sorry to say, but can you please post a request for this to our UserVoice forum: https://redgate.uservoice.com/forums/94413-sql-prompt?

    Thank you!
    krzysztofkroczak
    0
  • way0utwest
    Well, Prompt get remove if you reformat (CTRL+K,Y). As for removing on scripting, that's an SSMS function. We can't jump into that. Now, the Prompt menu with script as alter might be able to tag this together with a format, but I'm not sure. I think this is just calling the SSMS function.

    Is there a reason reformatting doesn't work?
    way0utwest
    0
  • ggeier
    SQL Prompt will script without brackets (if the SP doesn't have them) when scripting as long as I use F12 -- this is exactly what I'd like to happen. It looks like scripting from the object explorer will always add in the brackets.

    I generally like ctrl+ky, but I like some SPs just the way they are, so I'd like to keep the code formatting the way it is by default.
    ggeier
    0

Add comment

Please sign in to leave a comment.