How to auto-complete all columns in "select * from table" in SQL Server Management Studio

Found this myself.

  1. Type Select * From TableA in SSMS.
  2. Exactly Select text Select * From TableA.
  3. Use Ctrl+Shift+Q to pop up Query Designer window.
  4. Click OK. "*" is replaced by "c1, c2, c3..."

Query Designer auto-populates all the columns. just open it & close. if you want only portion of columns, I found it is still easier to delete them on text editor than trying to use mouse to uncheck them on GUI.

Still hope to find a way to eliminate the Keyboard/mouse switch on step 4? seems there is no short-cut key for the OK button.

Update 2019-06-24

Above method does not work for table in SQL Azure. ApexSQL SQL formatter seems working well for me, it's free.

enter image description here

Update 2020-10-30

found a similar function in LINQPad, it allows me to auto-complete all properties in LINQ, See here

enter image description here


In SQL Server Management Studio if you expand the object explorer and then the node for the particular table in question then you can drag the columns node into the query window and this will type out all of the column names for you.

There are probably better ways to do this, but that's what I use.

Tags:

Tsql

Ssms