Posted by Hugo Kornelis on 02/16/06 21:51
On 15 Feb 2006 20:43:49 -0800, Shwetabh wrote:
>> Why would it be necessary to use SELECT * in such a scenario? SELECT *
>> is slow because it requires extra work by the server to retrieve the
>> column metadata. It's unreliable because more code may break if and
>> when the table structure changes. It's hard to maintain because you
>> can't easily search for column dependencies in your code during
>> development.
(snip)
>
>I understand what you are saying. But consider this scenario:
>A user needs a few more fields in the database and adds them to a table
>kept for the purpose. Now how can _those_ fields be accessed without
>using select *?
Hi Shwetabh,
Easy.
In the parts of the application that have to use the new column, you can
add it to the column list in the SELECT statement at the same time
you're making the change to use the column.
And in the parts of the application that don't have to use the new
column, you don't have to change anything.
--
Hugo Kornelis, SQL Server MVP
[Back to original message]
|