Published on

December 26, 2016

Exploring SQL Server Management Studio’s Drag and Drop Capability

SQL Server Management Studio (SSMS) is a powerful tool that offers a wide range of features and functionalities for managing SQL Server databases. While many users are familiar with the basic functionalities of SSMS, there are some lesser-known features that can greatly enhance productivity. In this blog post, we will explore one such feature – the drag and drop capability of SSMS.

During a recent conversation with a colleague, I discovered an interesting way to quickly retrieve information about tables, columns, and constraints from a database using SSMS. Typically, one would use DMVs like sys.tables and sys.columns to obtain this information. However, SSMS provides a more intuitive and efficient method.

To retrieve the name of a table, column, or constraint, simply select the desired object in SSMS and drag it to the command window. The name of the object will be automatically populated in the command window, saving you the effort of manually typing the object name or querying the DMVs.

For example, if you want to retrieve the name of a table, select the table in SSMS and drag it to the command window. The table name will appear in the command window, ready for use in your queries or scripts. The same can be done for columns and constraints as well.

Here is a sample output:

Table Name: [dbo].[Customers]
Column Name: [dbo].[Customers].[CustomerID]
Constraint Name: [dbo].[Customers].[PK_Customers]

It is worth noting that this feature has been available in SSMS for quite some time, yet it remains relatively unknown to many users. Additionally, it is important to mention that the behavior of this feature may vary depending on the version of SSMS you are using. The example provided in this blog post is based on SQL Server 2016 Management Studio.

One limitation I encountered while exploring this feature is that when dragging the “Keys” column, the resulting output does not include the comma-separated values. This may be a bug that will be addressed in future releases of SSMS.

If you have used this drag and drop capability in SSMS, I would love to hear about your experiences. Feel free to share any interesting use cases or tips in the comments section below. Sharing knowledge and experiences is a great way to learn and grow together.

Thank you for reading and stay tuned for more SQL Server tips and tricks!

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.