How can I see where the tab stops are in the SQL Server Management Studio editor?

一笑奈何 提交于 2019-12-01 05:35:20

问题


I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time.


回答1:


Management Studio supports an undocumented feature that Visual Studio has as well. It adds vertical guide lines to the editor window at specific column locations.

Create a .reg file using the text below and open it to merge it with your registry. This will add a line every 8 characters (up to column 96) in SQL Server 2005. Modify as needed to suit your tab size. It does not appear to support more than 12 lines. The RGB portion of the string is supposed to set the color, but it always displays as black for me. You'll quickly notice why this is an undocumented feature - the lines appear in unwanted locations such as the Messages output window.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Shell\Text Editor]
"Guides"="RGB(128,0,0) 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96"



回答2:


Perhaps SQL Refactor by Red Gate. You can define the desired layout of the code, and then simply use command "Lay Out SQL".

When you install SQL Refactor it adds extra menu item to the Management Studio main menu. Each command has its keyboard shortcut (e.g. for Lay Out SQL it is Ctrl+B Ctrl+L) so I assume you should be able to assign that command to your speech recognition tool.

SQL Refactor comes with the price but you can be download 14-day full working trial to try it it serves your needs.



来源:https://stackoverflow.com/questions/332574/how-can-i-see-where-the-tab-stops-are-in-the-sql-server-management-studio-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!