Select Distinct Logo Clear Background

Business Analytics Blog

Drag and Drop Field Names in SQL (SSMS)

Drag and Drop field names in SSMS cover

Drag and drop is a common and convenient way to move data and objects in SQL Server Management Studio (SSMS).

With the object explorer, you can easily drag field names from a table.  Then drop them into a query window to quickly create a SELECT statement.

How to drag and drop field names in SQL

To use this feature, first open the object explorer and navigate to the table that contains the fields you want to use.

Then, expand the table and right-click on the “Columns” folder.

Select “Select Top 1000 Rows” to open a new query window with a SELECT * statement.

Next, simply click and hold on the field name you want to use and drag it into the query window.

Most people know about dragging a field at a time

But, we find a lot of users are surprised when we show them this

Select ALL Columns with drag and drop

You can also drag field names directly into the SELECT portion of an existing query.

Simply position your cursor where you want to insert the field names and drag them into the query.

In addition to dragging field names, you can also use the object explorer to drag and drop an entire list of fields from a table into a query.

Simply expand the database in the object explorer and drag the word ‘columns’ into the query window. This will automatically create a comma separated list of fields in the query editor.

This is our preferred method as it is also quick and easy to delete any surplus fields you may want to remove from your query

Watch this video to see it in action

Overall, the drag and drop feature in the object explorer is a quick and convenient way to create SELECT statements and add tables to your queries in SSMS.

It can save you time and effort by eliminating the need to manually type out the names of fields and tables.

Don’t type field names

We find that once the analysts we work with know how to drag and drop field names in SQL we see them using this great SQL timesaver very often

Watch the video

Blog post by Simon Harrison
Simon Harrison

Simon Harrison Founder of Select Distinct Limited and a business intelligence expert

Subscribe to our channel to see more Power BI Timesavers

Select Distinct YouTube Channel

Our Business Analytics Timesavers are selected from our day to day analytics consultancy work.  They are the everyday things we see that really help analysts, SQL developers, BI Developers and many more people.

Our blog has something for everyone, from tips for improving your SQL skills to posts about BI tools and techniques. We hope that you find these helpful!

Business Analytics Blog