Asterisk vs. Field Names

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

When specifying all fields in a table in a select statement
does it make much difference whether one uses the asterisk
for all fields or is it more acceptable to specify each field name?

Thanks,
James
 
JamesJ said:
When specifying all fields in a table in a select statement
does it make much difference whether one uses the asterisk
for all fields or is it more acceptable to specify each field name?

There might be a miniscule performance penalty for * because the query engine
must retrieve the names from the system tables. Otherwise * has the advantage
that if new fields are added to the base table later on the query will
automatically pick the new fields up. A query that explicitly named the fields
would have to be modified.

I believe most of the "bad press" that the use of * gets is when people use *
even when they DON'T need all of the fields just out of laziness. If I need all
of the fields then that is what I use.
 
Thanks

Rick Brandt said:
There might be a miniscule performance penalty for * because the query
engine must retrieve the names from the system tables. Otherwise * has
the advantage that if new fields are added to the base table later on the
query will automatically pick the new fields up. A query that explicitly
named the fields would have to be modified.

I believe most of the "bad press" that the use of * gets is when people
use * even when they DON'T need all of the fields just out of laziness.
If I need all of the fields then that is what I use.
 
Back
Top