ssms win10

I have been using SSMS for a long time now, and over the period of time I have realized that it’s a very powerful IDE – however, there are lots of hidden features which are less known to lots of developers. In this article, I will be sharing some beneficial Tips and Tricks which will give you an extra edge in your day to day work, and in the process take your productivity to the next level.

我使用SSMS已有很长时间了,一段时间以来,我意识到这是一个非常强大的IDE –但是,有很多隐藏的功能对于很多开发人员来说鲜为人知。 在本文中,我将分享一些有益的技巧和窍门,这些技巧和窍门将使您在日常工作中获得更多的优势,并在此过程中将工作效率提高到一个新的水平。

I would highly recommend you to go through my last 2 articles relating with SSMS Productivity, if you have not gone through it already –

如果您还没有阅读过有关SSMS生产力的文章,我强烈建议您阅读我的前两篇文章–

  • SQL Server Management Studio 2016 Productivity Enhancements SQL Server Management Studio 2016生产力增强
  • Increase your Coding Speed in SQL Server Management Studio 在SQL Server Management Studio中提高编码速度

使用自定义颜色区分环境 (Use custom colors to differentiate between environments)

During our day to day work in SSMS, generally we have to shift between different environments – Local/DEV/QA/MOCK/PROD, resulting in the creation of multiple query tabs – with each query tab connected to different environments. This often becomes unmanageable and difficult to keep track of. Also, think about a scenario when you have a data manipulation script to be executed in different environments, isn’t it a big advantage to have a visual differentiation between the environments you are executing your scripts against?

在SSMS的日常工作中,通常我们必须在不同的环境(本地/ DEV / QA / MOCK / PROD)之间切换,从而导致创建多个查询选项卡-每个查询选项卡都连接到不同的环境。 这通常变得难以管理并且难以跟踪。 另外,考虑一个场景,当您要在不同的环境中执行数据操作脚本时,在执行脚本的环境之间进行视觉区分是否有很大的优势?

SSMS provides us with an ability to set different colors for connection to separate environments. Personally, I prefer to set the below colors for my environments — PROD – Red, MOCK – Orange, QA – Yellow, DEV – Blue and Local – Green

SSMS为我们提供了设置不同颜色以连接到单独环境的能力。 就个人而言,我更喜欢为我的环境设置以下颜色-PROD-红色,MOCK-橙色,QA-黄色,DEV-蓝色和Local-绿色

The color is displayed in the SSMS status bar, at the bottom. Hence when you connect with a particular environment, it uses the same assigned color. This presents a visual indication of the environment in which you are running your scripts.

颜色显示在底部的SSMS状态栏中。 因此,当您连接到特定环境时,它会使用相同的分配颜色。 这可以直观地指示您在其中运行脚本的环境。


SELECT 'Local DB for Update/Delete/Insert' AS 'Environment'
SELECT 'DEV DB for Update/Delete/Insert' AS 'Environment'
SELECT 'PROD DB for Select' AS 'Environment'

When you are connecting to a SQL Server instance, you will need to click on the ‘Options’ button:

连接到SQL Server实例时,需要单击“选项”按钮:

Then click on the ‘Connection Properties’ tab and you can choose a custom color for your environment:

然后单击“连接属性”选项卡,然后可以为您的环境选择自定义颜色:

Once you select a color for an environment, every time you login to that SQL Server instance – it will display the same color in the SSMS status bar. For developers running data manipulation scripts, it’s always nice to have a visual indication of the environment you are logged in – especially a RED color in your SSMS query editor, indicating you to be extra cautious.

为环境选择颜色后,每次登录该SQL Server实例时,它将在SSMS状态栏中显示相同的颜色。 对于运行数据操作脚本的开发人员而言,最好直观地指示您所登录的环境-特别是SSMS查询编辑器中的红色,这表示您格外小心。

通过存储在内存中重复使用复制的项目 (Reuse your copied items by storing in memory)

Two shortcut keys which every developer use in their day to day work is CTRL+C and CTRL+V. The problem with pasting your copied contents using CTRL+V is that it only pastes the last copied text. ‘Cycle Clipboard Ring’ feature in SSMS allows you to keep track of last 20 items you have cut/copy and reuse them without any need of copying and pasting text multiple times.

每个开发人员在日常工作中使用的两个快捷键是CTRL + C和CTRL + V。 使用CTRL + V粘贴复制的内容的问题在于它仅粘贴最后复制的文本。 SSMS中的“循环剪贴板铃声”功能使您可以跟踪最近剪切/复制的20个项目并重复使用它们,而无需多次复制和粘贴文本。

You can use CTRL+SHIFT+V to paste the current item in Clipboard Ring’s memory. If you repeatedly press CTRL+SHIFT+V, you can actually cycle through all the entries in Clipboard Ring’s memory, and then select the item you want to paste in your code editor.

您可以使用CTRL + SHIFT + V将当前项目粘贴到剪贴板环的内存中。 如果您反复按CTRL + SHIFT + V,则实际上可以循环浏览Clipboard Ring内存中的所有条目,然后在代码编辑器中选择要粘贴的项目。

同时编辑多行代码 (Edit multiple lines of code at the same time)

SSMS provides a ‘Vertical Block Select Mode‘ feature by which you can select multiple lines, type code and it will reflect across all the selected rows. To leverage this feature, you need to hold down the ALT key, then left click on your mouse to drag the cursor over the text you want to select and type/paste the text you want to insert into multiple lines. Pressing the ALT key is important, since it indicates to the query editor to not select the entire line but to follow the mouse pointer/ arrow keys for any action.

SSMS提供了“ 垂直块选择模式 ”功能,通过它可以选择多行,键入代码,它将反映在所有选定行中。 要利用此功能,您需要按住ALT键,然后在鼠标上单击鼠标左键以将光标拖到要选择的文本上,然后将要插入的文本键入/粘贴到多行中。 按下ALT键很重要,因为它指示查询编辑器不要选择整行,而是要遵循鼠标指针/箭头键进行任何操作。

Keyboard Shortcut – ALT + SHIFT + Arrow Keys Mouse – ALT + Left-Click + Drag

键盘快捷键– ALT + SHIFT +方向键鼠标– ALT +左键单击+拖动

利用SSMS中内置的绩效报告 (Leverage built in Performance Reports in SSMS)

SSMS provides a number of standard database level reports out of the box for performance monitoring and troubleshooting purpose. The best thing about these reports are that it encapsulates all the complexity behind generating them and displays the results in the form of graphical reports – which can be used in any of your presentations.

SSMS提供了许多现成的标准数据库级别报告,用于性能监视和故障排除。 这些报告的最好之处在于,它封装了生成报告后的所有复杂性,并以图形报告的形式显示结果-可在您的任何演示文稿中使用。

To access the reports, Right Click on the Database –> Go to Reports –> Go to Standard Reports –> Pick any of the SSMS Reports

要访问报告,请右键单击数据库–>转到报告–>转到标准报告–>选择任何SSMS报告

For instance, the below ‘Disk Usage’ report displays the total amount of space that the AdventureWorks2008 is occupying and the free space available.

例如,下面的“磁盘使用情况”报告显示AdventureWorks2008正在占用的空间总量和可用空间。

To view the details of the Standard SSMS Reports, please review the MSDN article here – SQL Server Management Studio Standard Reports – The Full List

要查看标准SSMS报告的详细信息,请在此处查看MSDN文章– SQL Server Management Studio标准报告–完整列表

使用SSMS生成SQL插入脚本 (Generate SQL Insert scripts using SSMS)

To generate scripts for your database tables, SQL Server Management Studio provides a handy wizard called as ‘Generate and Publish Script‘. You can also use this wizard to generate insert scripts for your tables.

为了为数据库表生成脚本,SQL Server Management Studio提供了一个便捷的向导,称为“生成和发布脚本”。 您也可以使用此向导为表生成插入脚本。

Right Click on the Database and go to Tasks -> Generate Scripts

右键单击数据库,然后转到任务->生成脚本

Next, you can select the database object you want to script.

接下来,可以选择要编写脚本的数据库对象。

Be default, the wizard allows you to generate scripts for the table schema only. However, if you need to generate Insert scripts for your table data, you will need to navigate to the ‘Advanced Scripting Options‘ and change the ‘Types of data to script‘ from ‘Schema only’ to ‘Data only’.

默认情况下,该向导仅允许您为表模式生成脚本。 但是,如果需要为表数据生成插入脚本,则需要导航到“高级脚本选项”,并将“脚本的数据类型”从“仅模式”更改为“仅数据”。

解决SSMS中的Intellisense问题 (Troubleshoot issues with Intellisense in SSMS)

Sometimes when you create a database object, SSMS is not able to identify the newly created object and throws an error stating – ‘Invalid object name’

有时,当您创建数据库对象时,SSMS无法识别新创建的对象,并引发错误,指出“无效的对象名称”

This is because of a simple reason that the SSMS Intellisense cache has not been refreshed. In such cases, you can use a simple shortcut CTRL+SHIFT+R to update the Intellisense cache. You can also navigate to this setting by going to Edit -> IntelliSense -> Refresh Local Cache.

这是由于未刷新SSMS Intellisense缓存的简单原因。 在这种情况下,您可以使用简单的快捷键CTRL + SHIFT + R来更新Intellisense缓存。 您还可以通过转到编辑-> IntelliSense->刷新本地缓存来导航到此设置。

This is a handy tip and can save you time, if you stumble into scenarios where intellisense does not function as expected.

这是一个方便的提示,如果您遇到智能感知无法正常工作的情况,可以节省时间。

在SSMS中恢复未保存SQL查询 (Recover your unsaved SQL queries in SSMS)

Most of you must have had instances where you lose your unsaved work – due to SSMS crashes or sudden machine reboots due to a windows update. It is very helpful to be aware of the ‘auto-recovery feature’ in SSMS where you can configure how frequently you want to save your work and how long you want to preserve the information. This is not a substitute to saving your work on a regular basis, but for sure can minimize your data loss and save rework time, in the case of unfortunate incidents.

大多数人肯定遇到过因SSMS崩溃或Windows更新导致机器突然重启而丢失未保存工作的情况。 了解SSMS中的“自动恢复功能”对您很有帮助,您可以在其中配置保存工作的频率和保存信息的时间。 这不能代替定期保存您的工作,但是在不幸的情况下,可以确保最大限度地减少数据丢失并节省返工时间。

You can also navigate to this setting by going to Tools -> Options -> Environment -> AutoRecover

您还可以通过转到工具->选项->环境->自动恢复来导航到此设置

Based on the above setting, SSMS tries to recover the unsaved queries and prompts a dialog box to the user, in the case of an unexpected SSMS shutdown.

根据上述设置,在意外关闭SSMS的情况下,SSMS尝试恢复未保存的查询并向用户提示对话框。

If due to some reason, you so not get the file recovery prompt, you can navigate to the folder location below where the backup files are located.

如果由于某种原因而没有收到文件恢复提示,则可以导航到备份文件所在的文件夹位置。

自定义您的环境以提高生产力 (Customize your environment for better productivity)

When you are working in an IDE, it is essential to be aware of all the features/options you have access to. A superlative knowledge of the IDE helps you to code and work faster. By default, SSMS has a fixed number of buttons added to the toolbar, but you can always personalize the button bars as per your needs. Having all the frequently used functions right in front of you in the toolbar gives you quick access, helps you become more productive, focus on your work and get more stuffs done in less amount of time.

在IDE中工作时,必须了解您可以访问的所有功能/选项。 对IDE的最高级了解可帮助您更快地编码和工作。 默认情况下,SSMS在工具栏上添加了固定数量的按钮,但是您始终可以根据需要个性化按钮栏。 通过工具栏中的所有常用功能,您可以快速访问,帮助您提高工作效率,专注于工作并在更短的时间内完成更多的工作。

You can click ‘Add or Remove Buttons’ option in the toolbar to remove the features you rarely use, and have just a handy set of options available which you will use in your day to day work.

您可以单击工具栏中的“添加或删除按钮”选项以删除您很少使用的功能,并且只有一组可用的选项可供您在日常工作中使用。

I removed few button controls, highlighted above in red, to customize my toolbar.

我删除了一些按钮控件(上面以红色突出显示)来自定义我的工具栏。

You can do the same by getting rid of features, which you do not use frequently. The result will be a much cleaner toolbar, on which you have complete control on.

您可以通过删除不经常使用的功能来完成此操作。 结果将是一个更加干净的工具栏,您可以完全对其进行控制。

从SSMS内获取在线文章的帮助 (Take assistance of online articles from within SSMS)

While working on your code changes in SQL Server, you might need to refer the internet multiple times. With this handy tip, there is no need to leave SSMS and open a web browser to search for the required information. You can actually open a web browser from inside SSMS by using a keyboard shortcut CTL+ALT+R. You can also click directly on the ‘Web Browser’ icon on the toolbar.

在SQL Server中处理代码更改时,可能需要多次引用Internet。 有了这个方便的技巧,就无需离开SSMS并打开Web浏览器来搜索所需的信息。 实际上,您可以使用键盘快捷键CTL + ALT + R从SSMS中打开Web浏览器。 您也可以直接单击工具栏上的“ Web浏览器”图标。

For convenience purpose, you can also leverage the Horizontal/Vertical Tab Group Feature to have your SQL Query and Web Browser in side by side independent windows and perform your development work much faster.

为了方便起见,您还可以利用“水平/垂直”选项卡组功能将SQL查询和Web浏览器并排在独立的窗口中,并以更快的速度执行开发工作。

在SSMS查询编辑器中显示行号 (Displaying Line Number in SSMS Query Editor)

While working on a large SQL script or a stored procedure with long lines of code, it’s beneficial to have the line numbers displayed in the Query Editor. By default, displaying Line numbers in SSMS is turned off. This is sometimes frustrating because it makes the navigation between long lines of code tougher. Also, think about a scenario when you run a TSQL query and SQL Server throws you an error message referencing the exact location of the error (in this case Line 42). How convenient would it have been if the SSMS Query Editor displays the Line Number out of the box?

在处理大型SQL脚本或具有较长代码行的存储过程时,将行号显示在查询编辑器中是有益的。 默认情况下,在SSMS中显示行号是关闭的。 有时这很令人沮丧,因为它使长行代码之间的导航更加困难。 另外,请考虑一种情况,当您运行TSQL查询时,SQL Server会向您抛出一条错误消息,引用错误的确切位置(在本例中为第42行)。 如果SSMS查询编辑器开箱即用地显示行号,将会有多方便?

This is one of the hidden features of SSMS and you can actually display line numbers with all the earlier versions of SSMS starting SQL Server 2005. You can enable this feature by navigating to – –Tools -> Options -> Text Editor -> All Languages -> General -> Line numbers

这是SSMS的隐藏功能之一,您实际上可以从SQL Server 2005开始使用所有早期版本的SSMS显示行号。您可以通过导航至– – 工具->选项->文本编辑器->所有语言来启用此功能。 ->常规->行号

Once you select the Line numbers checkbox, click OK and return to the Query Editor, you will see that line numbers have been enabled.

选中“行号”复选框后,单击“确定”并返回到“查询编辑器”,您将看到已启用行号。

 INSERT INTO [AdventureWorks2008].[Sales].[Currency]([CurrencyCode],[Name],[ModifiedDate]VALUES('USD','US Dollar','2016-12-01 00:00:00.000')

You can also leverage a pretty handy shortcut to easily jump to a particular line number – CTRL + G

您还可以利用便捷的快捷方式轻松跳转到特定的行号– CTRL + G

结论 (Conclusion)

SSMS has a number of hidden features which might not have been advertised much, but knowing these tips and tricks will make your life so much easier. I would highly recommend you to start using these tips and tricks in your day to day work, and you will realize the increase in your overall productivity and efficiency.

SSMS具有许多隐藏的功能,这些功能可能不会广为宣传,但是了解这些提示和技巧将使您的生活变得更加轻松。 我强烈建议您在日常工作中开始使用这些提示和技巧,并且您会意识到整体生产率和效率的提高。

To further enhance coding productivity, try ApexSQL Complete, a free SSMS and Visual Studio add-in.

为了进一步提高编码效率,请尝试使用ApexSQL Complete (免费的SSMS和Visual Studio加载项)。

翻译自: https://www.sqlshack.com/10-ssms-tips-and-tricks-to-boost-your-productivity/

ssms win10

ssms win10_10个SSMS技巧和窍门可提高您的生产力相关推荐

  1. ssms2008 代码自动提示_使用 SSMS 的提示和技巧 - SQL Server Management Studio (SSMS) | Microsoft Docs...

    使用 SQL Server Management Studio (SSMS) 的提示和技巧Tips and tricks for using SQL Server Management Studio ...

  2. Visual Studio 2005 IDE 技巧和窍门

    发布日期: 2007-02-26 | 更新日期: 2007-02-26 James Lau Microsoft 项目经理 适用于: Microsoft Visual Studio 2005 摘要:Vi ...

  3. 在Kaggle上赢得大数据竞赛的技巧和窍门

    在Kaggle上赢得大数据竞赛的技巧和窍门 解决方案 平台 数据 应用 方法 阅读1906  原文:The tips and tricks I used to succeed on Kaggle  作 ...

  4. vue双击事件_我总结了12个Vue.js开发技巧和窍门

    我真的很喜欢使用Vue.js,每次使用框架时,我都会喜欢深入研究其功能和特性.通过这篇文章,我向你介绍了12个很酷的提示和技巧,你可能尚未意识到这些技巧和窍门,以帮助你成为更好的Vue开发人员. 更漂 ...

  5. selenium编写脚本_Selenium脚本编写技巧和窍门

    selenium编写脚本 如果您刚刚开始学习Selenium,则以下技巧和窍门将成为您的救星. 这些技巧和窍门具有您可能会忘记的所有基本知识,将帮助您记住所有这些. 您只需浏览一次,几秒钟后您便会了解 ...

  6. jsoup爬虫教程技巧_Jsoup V的幕后秘密:优化的技巧和窍门

    jsoup爬虫教程技巧 我们已经把事情做好了,现在是时候加快工作速度了. 我们会牢记Donald Knuth的警告:"大约97%的时间我们应该忘记效率低下:过早的优化是万恶之源". ...

  7. Selenium脚本编写技巧和窍门

    如果您刚刚开始学习硒,则以下技巧和窍门将成为您的救星. 这些技巧和窍门具有您可能会忘记的所有基本知识,将帮助您记住所有这些. 您只需浏览一下它们,几秒钟后您就会了解所有内容. 让我们一一看一下所有的技 ...

  8. Jsoup V的幕后秘密:优化的技巧和窍门

    我们做对了,现在是时候更快地做事了. 我们会牢记Donald Knuth的警告:"大约97%的时间,我们应该忘记效率低下:过早的优化是万恶之源". 根据Jonathan Hedle ...

  9. Jupyter Notebook的15个技巧和窍门,可简化您的编码体验

    Jupyter Notebook is a browser bases REPL (read eval print loop) built on IPython and other open-sour ...

最新文章

  1. 计算机之间是如何实现通信的?—Vecloud微云
  2. redis常用数据结构解析
  3. 台湾大学林教授libsvm在matlab的安装
  4. from __future__ import print_function 介绍
  5. [转]C++模板学习
  6. mxnet基础到提高(40)-ndarray之运算(1)
  7. Zend Studio 高亮显示dwt和lbi
  8. 图解3种常见的深度学习网络结构:FC、CNN、RNN
  9. IMU传感器和预积分
  10. spring cloud Eureka 之配置信息
  11. VS中Eric觉得好用的快捷键
  12. Tips for ASP.NET Application Performance Enhancement
  13. Android hardware简易流程
  14. 系统发育树的美化~Figtree(图文教程)
  15. CubeMX编写风力摆控制系统[HAL库]
  16. littleVGL开发:littleVGL的介绍
  17. 免费的开源飞行规划软件Little Navmap
  18. 个人搭建独立博客,哪个程序比较好用
  19. 2021年全国职业院校技能大赛大数据应用技术国赛题
  20. VBA代码实例---Msgbox函数及应用实例

热门文章

  1. 网络商城html前端,商城 前端 html 页面 模板
  2. 线程池和定时器——多线程的自动管理(转载)
  3. 一、SecureCRT 8.0 客户端连接服务器
  4. 开发之没沟通误删客户数据库数据之找数据路
  5. [实变函数]5.6 Lebesgue 积分的几何意义 $\bullet$ Fubini 定理
  6. 请问asp.net网页里能显示tiff格式的图片吗?
  7. LeetCode(344)——反转字符串(JavaScript)
  8. 句句真研—每日长难句打卡Day12
  9. 【PHP学习】—PHP连接数据库(六)
  10. boot定时任务开启和关闭 spring_Spring-Boot 下定时任务通过配置文件控制开关和执行时间...