是否可以通过我可以传递完全限定的对象名称的方式将SSMS 2012键盘快捷键绑定到过程? [英] Is there a way to bind SSMS 2012 keyboard shortcuts to a procedure in a way where I can pass the fully qualified object name?
问题描述
在SSMS 2012中,有什么方法可以绑定键盘快捷键(例如 Ctrl - 5 ),以便突出显示合格的对象名称(例如
In SSMS 2012, is there any way I can bind a keyboard shortcut (e.g. Ctrl-5) so that I can highlight a qualified object name (e.g. master.sys.objects
) and invoke my own procedure using that object name as the argument?
我知道,如果我在使用键盘快捷键之前在对象名称周围添加引号或方括号(例如,突出显示字符串'sys.objects'
,这确实有效),但是当想要通过直接突出显示表轻松使用我的快捷方式时,这将变得很乏味在现有查询中.
I know that this does work if I explicitly add quotes or brackets around the object name prior to using the keyboard shortcut (e.g. highlight the string 'sys.objects'
, but this becomes tedious when wanting to use my shortcut easily by directly highlighting tables in existing queries.
有关更多上下文,我注意到 Alt - F1 (sp_help的快捷方式)现在支持完全限定的对象名称.例如,突出显示sys.objects
并按 Alt - F1 在SSMS 2012中非常有效(在SSMS 2008中则不行).这是
For more context, I noticed that Alt-F1 (the shortcut for sp_help) now supports fully-qualified object names. For example, highlighting sys.objects
and pressing Alt-F1 works perfectly in SSMS 2012 (it does not in SSMS 2008). Here is the relevant Connect issue that describes this enhancement.
但是,在查看此快捷方式的键盘绑定时,此操作看起来应该与在突出显示的文本上调用sp_help是同义的:
However, when looking at the keyboard binding for this shortcut, it looks like this action should be synonymous with invoking sp_help on the highlighted text:
事实并非如此,您可以通过对sp_help运行以下两个调用来看到,这两个调用均因错误Incorrect syntax near '.'.
而失败:
This turns out not to be the case, as you can see by running the following two calls to sp_help, both of which fail with error Incorrect syntax near '.'.
:
USE master
GO
EXEC sp_help sys.objects
GO
EXEC sp_help master.sys.objects
GO
如果我有一种方法可以调用我自己的过程,就像可以在没有括号或引号的情况下在限定对象上调用sp_help的方法一样,我很想知道!
If there is a way for me to be able to invoke my own procedures similar to the way sp_help can be invoked on qualified objects without brackets or quotes, I would love to know!
推荐答案
SSMS 2012支持2个不带引号的零件名称,对于3个零件名,您仍然需要引号.
SSMS 2012 supports 2 part names without quotes, for 3 part names you still need the quotes.
我仍然没有找到任何支持您想要的插件,也许您可以在SSMS Boost上创建一个宏( http: //www.ssmsboost.com/)自动添加括号,请运行命令,然后删除括号.我没有尝试用它做任何类似的事情,但是应该有可能
I still have not found any plugin that supports what you want, perhaps you could make a macro on SSMS Boost(http://www.ssmsboost.com/) to automatically add brackets, run your command then remove the brackets. I have not tried to do anything like this with it but it should be possible
这篇关于是否可以通过我可以传递完全限定的对象名称的方式将SSMS 2012键盘快捷键绑定到过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!