Beim Lesen von T-SQL im SSMS fehlt immer wieder eine Formatierungs-Hilfe.
Praktisch fand ich:
Quelle/n (des gleichen Entwicklers):
• https://github.com/TaoK/PoorMansTSqlFormatter
Ist GitHub, aber nur schwierig die richtige *.msi zu finden
• http://architectshack.com/PoorMansTSqlFormatter.ashx#Download_15
Hier muss man die „Extension for CURRENT VERSION of SSMS….“ suchen und kann die PoorMansTSqlFormatterSSMSPackage.Setup.1.6.16.msi laden und installieren.
Ggf. ist noch das .NET Framework 2.0 nötig:
Download .NET 2.0 SP1 (x64) from Official Microsoft Download Center
Das SSMS muss ggf. neu gestartet werden und dann ist im Menü „Tools“ der Punkt „Format T-SQL Code“
Benutzung:
Den SQL Code, den man in einer Query hat, kann man dann über den o.g. Punkt den Code neu formatiert anzeigen lassen. Typisch ist das nötig, wenn man komplexe Stored Procedure in einer einzigen Zeile findet.
Sollte man eine Fehlermeldung sehen:
---------------------------
Microsoft SQL Server Management Studio
---------------------------
The 'FormatterPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension.
You can get more information by examining the file
‚C:\Users\frank.odenbreit\AppData\Roaming\Microsoft\AppEnv\14.0\ActivityLog.xml‘.
Restarting Visual Studio could help resolve this issue.
Continue to show this error message?
—————————
Ja Nein
—————————
Lösung:
https://github.com/TaoK/PoorMansTSqlFormatter/issues/187
EINFACH DEN DIALOG MIT „NO“ bzw. „NEIN“ BESTÄTIGEN!!!!
Siehe d. o.g. Link:
…
Don't bother reading all that text - I messed up the installer during the split at the start of the week.
The problem will have been temporary (as long as you say "No" in the error dialog, the extension loads fine on next SSMS restart and forever after), but still, almost 300 downloads of the bad installer... :(
Fixed installer is live, downloadable at http://architectshack.com/PoorMansTSqlFormatter.ashx
Sorry about the inconvenience.
…
In einzelnen Fällen war das Menü deaktiviert („grau“). In dem Fall hat mir dieser Link geholfen die Konfiguration des SSMS anzupassen („ssms.exe.config“):
https://stackoverflow.com/questions/63313632/poor-mans-t-sql-formatting-add-in-format-t-sql-code-option-disabled-in-sql-ser