Search code examples
sqlsql-servert-sqlssmssql-view

How do i change the SQL Server Management Studio View Disgner Auto Formatting?


if you're working with Views and SQL Server Management Studio (i'm using version 14) then you probably have noticed it, the code you put in the view designer gets auto formatted

i personally think that the way of formatting is really ugly, especially that JOIN statements are always at the end of the line. however, i'd like to change that.

i already looked a bit up and i know we can install custom formatters, but they only work for sql files (like new queries) but that won't overwrite the default behaviour of the view designer

can anyone help me find a solution? i don't care whether it is downloading a tool or it would be already helpful if i could at least stop the auto formatting somehow so i can at least apply my own code style and then it's the same for everyone in the team

i highly hope you know any kind of approach here. thank you!


Solution

  • You cannot change the formatting being applied for DESIGN. Even in the new version of SSMS, I see that the code is formatted little differently in view designer. Even if you change through designer and save it and open it again, it is not keeping formatting changes and applies its formatting changes, when you open it again through View Designer.

    You can try the below approach:

    1. Right click the view and open in new window

    Right click View

    1. Now, you can apply formatting manually or you can any of the SQL formatting tools or corresponding SSMS add-on to formatting to the code. Now, the formatting will be kept intact if you open it again. Sql formatting tools