用于在 sql server management studio 查询窗口中选择当前块或执行当前块的键盘快捷键的加载项?

发布于 2024-11-07 05:27:21 字数 545 浏览 0 评论 0原文

在 TOAD 中,您可以通过键盘快捷键选择当前块或执行当前块......因此,如果您正在处理大型 sql 查询,则在进行修改时,只需按 CTRL+ENTER(或类似的东西,现在不记得了),而不必手动突出显示 sql 块并按下 F5。

我很确定 SSMS 本身不存在这种功能,有人知道任何插件中是否存在这样的功能吗?

抱歉......一些澄清......我正在谈论在查询窗口中工作,其中可能包含:

select * from SomeTable

select * from SomeTable
WHERE
    column1 = 'abc'
AND column2 = 'def'  <--- LET'S SAY MY CURSOR IS SITTING HERE
AND column3 = 'ghi'

select * from AnotherTable
WHERE
    column1 = 'abc'
AND column2 = 'def'
AND column3 = 'ghi'

所以,我只想执行我的光标位于的语句。

In TOAD, you have keyboard shortcuts where you can select the current block or execute the current block....so if you are working on a large sql query, when you make a modification, you can just do a CTRL+ENTER (or something like that, can't recall right now) rather than having to manually highlight the block of sql and htting F5.

I'm pretty sure this doesn't exist natively in SSMS, anyone know if functionality like this exists in any Add-ins?

Sorry....some clarification....I'm talking about working in the query window, which may contain:

select * from SomeTable

select * from SomeTable
WHERE
    column1 = 'abc'
AND column2 = 'def'  <--- LET'S SAY MY CURSOR IS SITTING HERE
AND column3 = 'ghi'

select * from AnotherTable
WHERE
    column1 = 'abc'
AND column2 = 'def'
AND column3 = 'ghi'

So, I just want to execute the statement that my cursor is within.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

烟花肆意 2024-11-14 05:27:21

加载项 SQL Complete 有这个确切的内容特征。执行当前语句而不选择它。他们的免费快速版本有它,但我也推荐标准版本的附加功能。这可以节省大量时间。

The add-in SQL Complete has this exact feature. Execute current statement without selecting it. Their free express version has it, but I also recommend standard version for its additional features. It's a major time-saver.

谈情不如逗狗 2024-11-14 05:27:21

好的,为了澄清您正在寻找的内容...如果您有以下带有文本选择光标的 T-SQL,如下所示:

DECLARE @Test Int
SET @Test = 1

IF @Test=1
BEGIN
    SELECT TestColumn1 FROM TestTable
    SELECT AnotherTestColumn FROM AnotherTestTable

    SELECT [A Valid Column]

    FROM [A Valid Table]

    SELECT LastColumn FROM LastTable ][ <- CURSOR HERE
END

您将需要某个热键(例如 Ctrl-F5)来执行 SELECT LastColumn FROM LastTable ...?或者 SELECT LastColumn FROM LastTable END (这就是您使用所描述的空白行规则得到的结果)?或者其他什么?中间用换行符分隔的语句怎么样,或者两个语句聚在一起怎么样?

如果您确实想使用空白行来定义“块”,那么作为插件应该很容易做到(示例/教程 此处);另一方面,如果您期望更多的“智能”,这可能是一项困难/复杂的任务,需要 SQL 解析等。

OK, so to clarify what you're looking for... If you had the following T-SQL with text selection cursor as indicated:

DECLARE @Test Int
SET @Test = 1

IF @Test=1
BEGIN
    SELECT TestColumn1 FROM TestTable
    SELECT AnotherTestColumn FROM AnotherTestTable

    SELECT [A Valid Column]

    FROM [A Valid Table]

    SELECT LastColumn FROM LastTable ][ <- CURSOR HERE
END

You would want a certain hotkey (eg Ctrl-F5) to execute SELECT LastColumn FROM LastTable...? Or SELECT LastColumn FROM LastTable END (which is what you would get with the blank row rule you described)? Or something else? How about the statement broken up with a line break in the middle, or the two statements bunched together?

If you really wanted to use blank rows to define "blocks", then that should be pretty easy to do as an Addin (sample/tutorial here); if, on the other hand, you expected a little more "intelligence", this could be a difficult/complex task, with SQL parsing required etc.

甜是你 2024-11-14 05:27:21

希望看到此功能添加到 ssms 查询分析器中。我是蟾蜍的长期用户。

我发现的最接近的方法是使用方向箭头突出显示查询,然后按 f5。 Toad 允许您只需将光标放在查询中的任意位置,然后按 cntl+enter 即可执行查询。这听起来并没有多大效率节省,但我真的很怀念它。

Would love to see this feature added to ssms query analyzer. I'm a long-time toad user.

The closest thing I've found is to highlight the query using directional arrows and then hit f5. Toad allows you to execute a query merely by placing the cursor anywhere within the query and then hit cntl+enter. It doesn't sound like much of an efficiency save but I really miss it.

椵侞 2024-11-14 05:27:21

您可以查看 SSMS 2012 的此加载项。将光标置于要执行的语句中,然后按 CTRL+SHIFT+E

SSMS 执行器 - http://ssmsexecutor.codeplex.com/

You can check out this add-in for SSMS 2012. Place the cursor within the statement you want to execute and press CTRL+SHIFT+E

SSMS Executor - http://ssmsexecutor.codeplex.com/

厌味 2024-11-14 05:27:21

不确定我是否遵循您的措辞,但是,您的意思是:

从光标开始逐行选择文本
SHIFT+ 向下键

执行查询编辑器的选定部分,如果未选择任何内容,则执行整个查询编辑器
F5 或 CTRL+E 或 ALT+X

解析查询编辑器的选定部分或整个查询编辑器(如果未选择任何内容)

CTRL+F5

MSDN SSMS 键盘快捷键

Not certain I'm following your wording, but, do you mean:

Select text down line by line starting from the cursor
SHIFT+ DOWN ARROW

Execute the selected portion of the query editor or the entire query editor if nothing is selected
F5 or CTRL+E or ALT+X

Parse the selected portion of the query editor or the entire query editor if nothing is selected

CTRL+F5

MSDN SSMS keyboard shortcuts

海未深 2024-11-14 05:27:21

我开发了 SSMSBoost 插件,我们最近添加了 Shift-F5(选择当前语句),然后按 F5(执行)将执行当前语句。
它适用于从 2008R2 到最新 18.1 的所有版本的 SSMS

I develop SSMSBoost add-in and we have recently added Shift-F5 (Select current statement), which, followed by F5 (Execute) will execute current statement.
It works in all versions of SSMS from 2008R2 till latest 18.1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文