Click to See Complete Forum and Search --> : What is better SELECT * or SELECT field names


anand99
April 23rd, 1999, 10:18 AM
What is better to use when retrieving all the fields from a table when making a query along one of the following lines

SELECT * FROM Customer WHERE CustomerID = 4

SELECT * FROM Accounts WHERE AccountID = 100 AND Customer ID = 4

What is better individually listing each field name in the query or using *. What is more faster and more efficient. Thanks for your help

frederiek
May 7th, 1999, 07:44 AM
I would take * because it is made for it.

Fraser
May 9th, 1999, 07:38 PM
It makes virtually no difference, because the SQL gets expanded from "SELECT *" to "SELECT [Field1], [Field2], etc." before the database engine is queried.

The only overhead is when the SQL is initially parsed and for most cases this will be negligable.