You might have heard that SELECT * is bad for queries performance, however, often it is difficult to replace it with column names when the table has many columns. Let us learn in today’s video how we can replace STAR (*) by column name efficiently in SSMS.
In today’s video, I have explained how quickly and efficiently with the help of the SQL Server Management Studio, we can replace the * by column names from the same table.
Now if you have more than one table, you will have to do the same process multiple times.
There are many reasons why people do not like SELECT * in their queries and here are just selected few reasons.
- Retrieves unnecessary columns and increases network traffic
- When new columns are added views needs to be refreshed manually
- Leads to the usage of a sub-optimal execution plan
- Uses clustered index in most of the cases instead of using optimal index
- It is difficult to debug
Please leave a comment with any other disadvantage if I have missed to list them. In most cases, it is not a good idea to use SELECT * in the query and we should replace star with column names.
If you like my videos, I request you to like, share, comment, and subscribe to these videos. Here is the link to my YouTube Videos.
Reference:Â Pinal Dave (https://blog.sqlauthority.com)Â
1 Comment. Leave new
I learned another trick from a blog post of Steve Stedman (I believe it was). Select the statement and then press CTRL-SHIFT-Q, copy and past the columns. We have an ERP system with a couple of thousand tables and it is more of a hassle for me to first find the table :-).