Is there a way to tell SQL Prompt ignore a certain schema when reformatting code

manjukemanjuke Posts: 4 Bronze 2
Consider the following syntax:

SELECT * FROM APP_SETTINGS


I have setup the prompt to use aliases and to add schema during the code format. In my database there two objects with the same name but having two different schemas.
  • DM.APP_SETTINGS
  • dbo.APP_SETTINGS
I want to tell prompt to ignore the schema DM objects during the code formatting. At the moment it's only considering the first schema and formats the code as follows:

SELECT * FROM DM.APP_SETTINGS AS A

Any help or suggestion is highly appreciated.

Thanks & Regards
Manjuke


Tagged:

Answers

  • Hi Manjuke,

    In SQL Prompt, you can specify the databases and schemas that you want to exclude.
    In SSMS, under SQL Prompt->Options->Connections->Suggestions, the below option can be used for this

    Once this is selected, you can specify the required details in the below table


    Please let me know if this helps.

    Regards,
    Sujay



  • manjukemanjuke Posts: 4 Bronze 2
    Hi Sujay,
    Thanks for the details. But actually, I don't want to stop this schema from loading. I need to load the schema to the IntelliSense, but only I need to exclude it when I am formatting the code.

    I don't think we have such an option at this point. Hence I suggest that it would be good if we have such feature, which is to choose the object if there are multiple objects having same name with different schema during the code formatting.

    For the time being, I will try an alternate workaround.

    Thanks & Regards

    Manjuke
  • Hi Manjuke,

    Thank you. This does seem to be a good feature to have. I will pass on this information to the development team.
    It would also help if you could raise this as a feature request at https://redgate.uservoice.com/forums/94413-sql-prompt

    The more votes and comments a topic receives will increase the chances of it being included in a future version of the product. The Product Managers and Development Team actively monitor the User Voice forums.


Sign In or Register to comment.