SQL Server SSMS Default SELECT TOP <n> ROWS from SQL can I change the Order as a Default setting?

huangapple go评论63阅读模式
英文:

SQL Server SSMS Default SELECT TOP <n> ROWS from SQL can I change the Order as a Default setting?

问题

I get that we can right-click and SELECT TOP &lt;n&gt; ROWS from any given table in SSMS, is there any way to change this default script to that it also orders the records with ORDER BY 1 DESC?

我了解我们可以在SSMS中从任何给定的表中右键单击并选择SELECT TOP &lt;n&gt; ROWS,是否有办法将默认脚本更改为还按ORDER BY 1 DESC对记录进行排序?

What I would really like to increase my productiveness is

我真正想提高我的工作效率的是

Right-click - SELECT TOP <n> ROWS ORDER BY 1 DESC

右键单击 - 选择TOP <n>行,按1降序排序

Or do I have to have a snippet so once the records are returned that I then have to paste the snippet in?

或者我是否需要一个片段,以便在记录返回后,我必须粘贴该片段?

Or even bind a stored procedure to a keyboard shortcut?

甚至将存储过程绑定到键盘快捷键?

Many thanks

非常感谢

英文:

I get that we can right-click and SELECT TOP &lt;n&gt; ROWS from any given table in SSMS, is there any way to change this default script to that it also orders the records with ORDER BY 1 DESC?

What I would really like to increase my productiveness is

Right-click - SELECT TOP &lt;n&gt; ROWS ORDER BY 1 DESC

Or do I have to have a snippet so once the records are returned that I then have to paste a the snippet in?

Or even bind a stored procedure to a keyboard shortcut?

Many thanks

答案1

得分: 1

不,无法自定义在GUI中使用菜单选项时出现在查询窗口中的文本。此代码深藏在可执行文件和/或DLL的深处。

我建议使用代码片段而不是点-and-click 操作。或者,如果您真的想自定义UI,请查看是否有任何现有的SSMS插件可以实现这一点,或者编写您自己的插件。在这些日子里,为Azure Data Studio构建这样的功能可能会更容易些。

英文:

No, there is no way to customize what text appears in the query window when you use the menu options in the GUI. This code is buried somewhere in the bowels of the executable and/or DLLs.

I would suggest using a snippet instead of the point-and-click stuff. Or if you really want to customize the UI, see if any existing SSMS add-in does this, or write your own. It might be easier these days to build such a thing for Azure Data Studio, though.

huangapple
  • 本文由 发表于 2023年2月14日 21:34:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448600.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定