Andrew
Andrew

Reputation: 75

How do I use Poor Man's T-SQL Formatter in SSMS v20?

On installing SQL Server Management Studio v20, the menu items for Poor Man's T-SQL Formatter are gone.

enter image description here

Things worked fine in v18 after following the advice here: https://stackoverflow.com/a/72996345/4830285 Not so in v20.

How do I use the tool in SQL Server Management Studio v20?

Upvotes: 4

Views: 7496

Answers (3)

mlevils
mlevils

Reputation: 11

One SIMPLE solution is to use Notepad++ with the Poor Man's T-SQL Formatter plugin on it. Copy the script to Notepad++, format and bring the script back. This way you can use the formatter with SQL Server, Oracle and others.

Upvotes: 1

Shix
Shix

Reputation: 116

  1. Open regedit (Registry Editor)
  2. Find your way to HKEY_CURRENT_USER\SOFTWARE\Microsoft\SQL Server Management Studio
  3. If you have SSMS 19 installed you will find 19.0_IsoShell_Config, if you have SSMS 20 installed you will find 20.0_IsoShell_Config
  4. Rename it to 18.0_IsoShell_Config
  5. Run PoorMan's Setup.
  6. Change back the Registry folder back to 19.0_IsoShell_Config or 20.0_IsoShell_Config
  7. Find your SSMS installation folder and open the Common7/IDE folder (C:\Program Files (x86)\Microsoft SQL Server Management Studio 20\Common7\IDE) and open the ssms.exe.config file
  8. Under <assemblyBinding> Add :
<dependentAssembly> 
    <assemblyIdentity name="Microsoft.VisualStudio.Shell.12.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
    <bindingRedirect oldVersion="2.0.0.0-15.0.0.0" newVersion="15.0.0.0"/> 
</dependentAssembly>
  1. Open SSMS. You should find Poor Man's Formatter in the Tools

Upvotes: 6

Ranieri Ribeiro
Ranieri Ribeiro

Reputation: 71

I got it working this way.

Install SSMS 17.9.1

Install SSMS 20.x

Install PoorMansTSqlFormatter

copy PoorMansTSqlFormatterSSMSPackage.pkgdef to C:\Program Files (x86)\Microsoft SQL Server Management Studio 20\Extensions (located at C:\Program Files (x86)\Microsoft SQL Server Management Studio 17\Extensions or C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Extensions)

Re-open SSMS 20.x and it should appear under Tools. (you can now fix the shortcut keys CTRL-K CTRL-D)

Uninstall SSMS 17.9.1

https://github.com/TaoK/PoorMansTSqlFormatter/issues/283#issuecomment-1493274817

Upvotes: 7

Related Questions