7.9.08

Select * Vs Select column Name in SQL Server

In general, we used to put a select statement like,

Select * from TableName
Its one of the bad coding standard to retrieve the data from a particular table.
In turn, we have to specify the column name for the select statement.
The format should be,

Select ColName1, ColName2 etc.., from TableName
It will surely increase the performance of your query. Because, we are filtering the wanted column in the table + we specifying the exact column in the table.

Regards,
Venkatesan Prabu .J

2 comments:

  1. What about if I want to retrieve all the columns of my table? (I think for a large table, 30 columns) should take longer time since u send more data to ur SQL server, isnit?

    ReplyDelete
  2. if you retrieve all the column in the table, per my testing, select * and select column1, column2,...ColumnN are almost the same

    ReplyDelete