SQL Server Studio 管理中重复行的快捷方式?
在 Netbeans 和 Eclipse 中,您可以按 CTRL + Shift + Down (我认为这就是 netbeans),它将复制一行代码。这在 SQL Server Management Studio 中可能吗?这是与 SQL Server 2008 一起运行的
In Netbeans and Eclipse you can hit CTRL + Shift + Down (i think thats netbeans) and it will duplicate a line of code. Is that possible in SQL Server Management Studio? This is running with SQL Server 2008
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我认为您可以点击 CTRL + C 和 CTRL + V 而不选择任何文本,您可以复制该行在它下面。
编辑:适用于 SSMS18
I think you can hit CTRL + C and CTRL + V without any text selected and you can duplicate the line below it.
Edit: works in SSMS18
如果您使用 SSMS 18.0 或更高版本并且不使用 结果到网格 (当前占用CTRL+D),然后您可以更新“选项”菜单中的键绑定。
Edit.Duplicate
Query.ResultstoGrid
当您单击“确定”离开选项时,您应该会发现可以立即使用按键绑定。
编辑:添加了确认,仅从 SSMS 18.0 开始支持此功能(h/t @Darrin 进行确认)
If you're using SSMS 18.0 or above and don't use the shortcut for Results to Grid (which currently occupies CTRL+D), then you can update the key bindings in the Options menu.
Edit.Duplicate
Query.ResultstoGrid
When you click "OK" to leave Options, you should find that you can use the key binding straight away.
Edit: Added confirmation that this is only supported from SSMS 18.0 onwards (h/t @Darrin for confirming)
在 SSMS 18.2 中,[edit.Duplicate] 与 [CTRL+E, V] 和 [CTRL+D] 关联。最简单的方法就是删除 [CTRL+D] 与 [Query.ResultstoGrid] 的关联。那么这将仅说明[edit.Duplicate]。之后,您可以使用 [CTRL+D] 复制行。
我认为将保存结果更改为网格或文件时并不常见。
In SSMS 18.2 [edit.Duplicate] associated with [CTRL+E, V] and with [CTRL+D]. The easiest way is just remove association [CTRL+D] with [Query.ResultstoGrid]. Then this will state only for [edit.Duplicate]. After that you can use [CTRL+D] for duplicating rows.
I think it is not often case when you change saving result into grid or into file.
我使用这个 AutoHotKey 脚本来复制 CTRL + D 我习惯在 Visual Studio 中使用“重复行”功能:
I use this AutoHotKey script to replicate the CTRL + D "duplicate line" functionality I'm used to from Visual Studio:
我喜欢 @Matt Kemp 的 AutoHotKey 脚本解决方案,但我使用了这个脚本:
I like @Matt Kemp's AutoHotKey script solution, but I used this script instead:
这是我的 Autohotkey 脚本版本,允许 CTRL+D 复制当前行而不改变剪贴板。我第一次接触这个热键是在 Notepad++ 中,它让我着迷。一个常见的用例是想要用剪贴板中的值更改一行文本,但我首先想复制该行作为备份,我可以注释掉。
这个答案与 @Matt Kemp 的答案类似,但正如评论中所指出的,看似简单的脚本中存在一些不稳定的地方。
我的答案有以下差异:
我试图通过添加 sleep 语句来克服两个不稳定的问题。有时,当它将当前剪贴板保存到变量中时,它实际上将当前行保存到变量中,导致永远无法恢复原始剪贴板内容。在某些其他情况下,剪贴板中的值会粘贴到屏幕上,而不是复制当前行。我对脚本进行了修改,添加了一些延迟,这些延迟通常会给出我正在寻找的结果。它不像我想要的那么快,但由于结果不一致,我会稍微延迟一下。
我在 i7 计算机上使用 Windows 10 64 位。
设置标题匹配模式,2;窗口的标题可以在其中的任何位置包含 WinTitle 以进行匹配。
我觉得我需要经常调整这段代码,因为我注意到它在某些应用程序中表现得不稳定。如果您有可以进行测试的改进,请加入。
autohotkey ssms vba
Here's my version of an Autohotkey script to allow CTRL+D to duplicate the current line without altering the clipboard. My first exposure to this hotkey was in Notepad++ and it grew on me. A common use case is wanting to alter a line of text with a value in my clipboard, but I first want to make a copy of the line as a backup I can comment out.
This answer is similar to the one by @Matt Kemp, but as noted in the comments, there is some flakiness in what appears to be a simple script.
My answer has these differences:
sleep
delays that give it more consistent results.There are two flaky issues that I am trying to overcome by adding
sleep
statements. On occasion, when it saves the current clipboard into a variable, it actually saves the current line into the variable, resulting in never restoring the original clipboard contents. On some other occasions, the value in the clipboard gets pasted on the screen instead of duplicating the current line. I have hacked the script to add some delays that typically give me the result I'm looking for. It's not as snappy as I'd like, but I'll take a little delay over inconsistent results.I'm using Windows 10 64-bit on an i7 computer.
SetTitleMatchMode, 2 ; A window's title can contain WinTitle anywhere inside it to be a match.
I feel like I need to tweak this code every so often because I'm noticing it acting flaky in some application. Please chime in if you have a tested improvement that can be made.
autohotkey ssms vba
对于 SSMS 18 按 Ctrl + E、V
默认情况下是快捷方式。
请参阅下面的屏幕截图:
For SSMS 18 press Ctrl + E, V
It's a shortcut by default.
See the screenshot below: