admin管理员组

文章数量:1435859

Can someone tell me if I can do the following in SQL Server Management Studio v20.2? In another SQL application, I could type select a.* from <table> a and when I went back and deleted the *, I would see a list of the column names in table a AND be able to select multiple columns at once. In SSMS it only lets me select one column at a time. Then I need to type the , a. again.

I tried to capture a screen shot of it but the column list closes when it freezes the screen. I've looked through the Intellisense posts on Stack Overflow but none seem appropriate. I don't know what else it might be called.

Can someone tell me if I can do the following in SQL Server Management Studio v20.2? In another SQL application, I could type select a.* from <table> a and when I went back and deleted the *, I would see a list of the column names in table a AND be able to select multiple columns at once. In SSMS it only lets me select one column at a time. Then I need to type the , a. again.

I tried to capture a screen shot of it but the column list closes when it freezes the screen. I've looked through the Intellisense posts on Stack Overflow but none seem appropriate. I don't know what else it might be called.

Share Improve this question asked Nov 15, 2024 at 21:11 Sara M-SSara M-S 1 4
  • So if you google "screen capture with open dialogs" or similar it will show you how to take a screenshot without closing things. – Dale K Commented Nov 15, 2024 at 21:11
  • I am 99% sure the answer is "no" however. Is it that big a problem? – Dale K Commented Nov 15, 2024 at 21:12
  • SSDT has an "expand wildcard" refactoring - would be nice if that made its way into SSMS. Is annoying that it shows you them all in a tooltip when you mouseover the * but then doesn't have any nice way of getting it to expand that list – Martin Smith Commented Nov 15, 2024 at 21:48
  • @DaleK Big problem? No. Really darn annoying? Yes. But I'm the type who complains and gets frustrated, Googles, gets frustrated, then actually asks others. :) – Sara M-S Commented Nov 18, 2024 at 13:14
Add a comment  | 

1 Answer 1

Reset to default 0

I think most people use tab completion on the keyboard for this, and never switch to their mouse. So the process is type , a., plus the first (usually) one to three letters of the column, and then use tab to finish typing the rest of the column name. Occasionally you may need more characters or a down arrow or two, if column names are repetitive.

If your query uses a lot of columns, this is still slower than clicking columns from the same open list, as you describe. But up to four or five columns it can be just as faster or faster for a good typist, since you skip moving back to the mouse at all; your hands never leave the keyboard. It's also MUCH faster (and easier on the wrists) than the alternative of typing , a. and then switching back to the mouse for each item, which seems to be what you describe doing right now.

The other option is right-clicking the table name in the Object Explorer and choosing to "Script Table as..." => "Select To..." => "New Query Editor Window". This will give you list of all the columns. It's in a new window, but copy and paste works, and it's easy to do a ctrl+h to replace the leading [ with a.[, so it matches your table alias. If you really have 10s of columns, this can be effective.

本文标签: sql serverSSMS v202 Intellisense Selecting multiple columns from list generated by select *Stack Overflow