简体   繁体   English

CTRL + K、CTRL + F(格式代码)在 MS SQL Server 中不起作用

[英]CTRL + K, CTRL + F (Format Code) Not Working in MS SQL Server

The format selection command isn't working in SQL server management studio 2008 for me and I'm wondering if anyone might know how to get it working.格式选择命令对我来说在 SQL server management studio 2008 中不起作用,我想知道是否有人可能知道如何让它工作。 I don't know if it was ever working.我不知道它是否曾经工作过。

Do you have any add-ins installed?您是否安装了任何加载项? For me Ctrl + K , Ctrl + F brings up the SSMS Tools Pack find dialog.对我来说Ctrl + KCtrl + F会调出 SSMS 工具包查找对话框。 So perhaps this is happening because an add-in has taken over the keyboard combo.所以这可能是因为加载项已经接管了键盘组合。

Also, what is your keyboard scheme under Tools > Options > Environment > Keyboard?另外,您在工具 > 选项 > 环境 > 键盘下的键盘方案是什么? If this has been switched to "SQL Server 2000" you might try switching it back to Standard.如果这已切换到“SQL Server 2000”,您可以尝试将其切换回标准。

Finally, I believe there are cases where the keyboard shortcuts can get messed up depending on the co-existence and order of install for Visual Studio / BIDS etc.最后,我相信在某些情况下,根据 Visual Studio / BIDS 等的共存和安装顺序,键盘快捷键可能会变得混乱。

IN SQL SERVER 2014在 SQL SERVER 2014 中

  • First do: Ctrl + K首先做: Ctrl + K
  • Then: Ctrl + Y然后: Ctrl + Y

I know this post is really old, but for people searching for answers to this question I have this to add:我知道这篇文章真的很旧,但是对于寻找这个问题答案的人,我要补充一点:

The Ctrl + K , Ctrl + F key combination for format code comes from poorsql.com .格式代码的Ctrl + KCtrl + F组合键来自poorsql.com They have a SSMS/Visual Studio plugin.他们有一个 SSMS/Visual Studio 插件。 As of this date they currently support up to SSMS 2017.截至目前,他们目前最多支持 SSMS 2017。

This feature isn't available on SQL Server Management Studio.此功能在 SQL Server Management Studio 上不可用。

There are various add-on's you can use to do this.您可以使用各种附加组件来执行此操作。 I personally use ApexSQL .我个人使用ApexSQL It gives you the option to create your own format template, so that your code is always easily readable for you.它使您可以选择创建自己的格式模板,以便您的代码始终易于阅读。

Check this link: http://www.mssqltips.com/sqlservertip/2413/sql-server-management-studio-keyboard-shortcuts-part-1-of-2/检查此链接: http : //www.mssqltips.com/sqlservertip/2413/sql-server-management-studio-keyboard-shortcuts-part-1-of-2/

...You can select specific lines and hit CTRL + K followed by CTRL + C to comment it out and CTRL + K followed by CTRL + U to uncomment it out... ...您可以选择特定行并按CTRL + K然后按CTRL + C将其注释掉,按CTRL + K然后按CTRL + U取消注释...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM