是否可以在 Sql Server Management Studio Express 中自动缩进查询?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2090353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 05:07:28  来源:igfitidea点击:

Is it possible to auto-indent a query in Sql Server Management Studio Express?

sqlsql-serverssms

提问by André Pena

I mean, something equivalent to Ctrl + K + D from Visual Studio that automatically indents code. Is there something in this sense?

我的意思是,相当于 Visual Studio 中的 Ctrl + K + D 可以自动缩进代码。在这个意义上有什么吗?

回答by Tao

Just discovered this - yet another variation on this older question which has much more activity: SQL Formatter for SQL Management Studio

刚刚发现这个 - 这个旧问题的另一个变体,它有更多的活动:SQL Management Studio 的 SQL Formatter

I personally am a big fan of the Poor Man's T-SQL Formatter/ http://poorsql.com- but then I wrote it :)

我个人是Poor Man's T-SQL Formatter/ http://poorsql.com的忠实粉丝- 但后来我写了它:)

回答by Orland Mendes

By default no but you can always try a third party tools like SQL Prompt mentioned above or ApexSQL Refactor(slightly less options compared to SQL Prompt but it's a free product) or just use online formatter.

默认情况下不,但您始终可以尝试使用第三方工具,例如上面提到的 SQL Prompt 或ApexSQL Refactor(与 SQL Prompt 相比选项略少,但它是免费产品)或仅使用在线格式化程序。

回答by Mitch Wheat

SQL Promptfrom Red Gate can do this.

Red Gate 的SQL Prompt可以做到这一点。

If you just want simple formatting online then the same technology powers FormatSQL.com

如果您只想在线进行简单的格式化,那么相同的技术为FormatSQL.com 提供支持

回答by ChrisWerry

SQL Pretty Printer can also reformat SQL. Available as a stand alone app or a SSMS plugin. Free to download (with a nag screen but no other apparent limitations) from http://www.dpriver.com

SQL Pretty Printer 也可以重新格式化 SQL。可作为独立应用程序或 SSMS 插件使用。从http://www.dpriver.com免费下载(带有 nag 屏幕但没有其他明显限制)

There is an online version at http://www.dpriver.com/pp/sqlformat.htm?ref=g_wangz

http://www.dpriver.com/pp/sqlformat.htm?ref=g_wangz有一个在线版本

回答by Guido

There is also the SQLinForm formatter. It is an automatic SQL code formatter for all major databases including ORACLE, SQL Server, DB2, UDB, Sybase, Informix, PostgreSQL, Teradata, MySQL, MS Access etc. with over 100 formatting options.It has a windows hotkey add-on, so you can use it in SSMS. Link: www.sqlinform.com

还有 SQLinForm 格式化程序。它是所有主要数据库的自动 SQL 代码格式化程序,包括 ORACLE、SQL Server、DB2、UDB、Sybase、Informix、PostgreSQL、Teradata、MySQL、MS Access 等,具有 100 多个格式化选项。它具有 Windows 热键附加组件,所以你可以在 SSMS 中使用它。链接:www.sqlinform.com