Continuing on my recent trend of Management Studio tips, here is another that could save you a few minutes.
In today’s scenario, we need to write a select statement that returns only the first few columns of a table. It is a super simple statement, but instead of typing out all the column names, we can just drag and drop them from the Object Explorer.
Watch the video below for a quick demo.
If you are not a fan of the square brackets around each object name, then you can change the settings so they no longer appear.
From the menu, select Tools and then Options.
Select the SQL Server Object Explorer tab and then change the “Surround object names with brackets when dragged” to false. Click OK to save the changes.
It takes effect once you open a new query window.
Note: This setting only works for drag and drop. Generated scripts will still use the square brackets.