How to change default SELECT TOP 1000 query to use * instead of each field?

In SSMS 2008 R2, we have the default Select top 1000 and Edit top 200 queries from the right-click menu. I saw where you can change the # lines that it returns in the parameters.

What do I need, can I say to make SELECT * instead of expanding and including all fields?

This is not a performance issue or anything else, just annoying when querying tables with more than 5 fields, I would like to make select *.

For example, if I have a table with the following fields:

  • Firstname
  • Lastname
  • Birthday
  • Town
  • condition
  • Zip

When I right-click on this Persons table and select SELECT TOP 1000 ROWS, I need a query that will execute

SELECT TOP 1000 * FROM People 

and NOT

 SELECT TOP 1000 FirstName, LastName, Birthday, City, State, Zip FROM People 

EDIT I suspect that there really is no answer to this question, but I thought I would see if everyone understood.

+6
sql sql-server-2008
source share
3 answers

I do not believe that there is any way to configure my own SSMS function. However, you can use the SSMS toolkit to add "Custom Scripts" for this type of thing.

Screenshothot

(Although, to be honest, selecting columns and typing * can be as fast as navigating through menus)

Screenshothot 2

+3
source share

Why SSMS Developers Want To Encourage Bad Practice Since select * is a very bad practice, why do they want to encourage it?

I see that I don’t want to write all the fields in a quick non-production query, but since he does it for you, why don't you want him to do it right?

+3
source share

This is against best practice, so SSMS will not.

It’s best to either delete specific columns, or replace with * , or just leave it as it considers the default to select all columns for you anyway ...

Placing the cursor after TOP n and executing Ctrl-Shift-End , Shift-Up , * does not take much time, but I understand that when testing it makes little sense to use * over the full specification of the column, and it is more accurate.

If you combine the SSMS Tools Pack with the SSMS IntelliSense, you can probably type faster than scroll, right-click and select.

0
source share

All Articles