You are here: Re: select * in views « MsSQL Server « IT news, forums, messages
Re: select * in views

Posted by Peter on 04/16/06 22:33

"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns97A7C00123E9EYazorman@127.0.0.1...
> Serge Rielau (srielau@ca.ibm.com) writes:
>> Lastly I respectfully disagree with the subsequent note in this thread
>> that over specification of columns in a view has no performance impact.
>
> I think Peter's question actually was whether there was a performance
> impact of saying "SELECT *" instead of listing all columns in the table
> explicitly, and for all my dislike for SELECT * in production code, I
> can't think of any reason why SELECT * should be any more expensive in
> SQL Server.
>
> I completely agree with that best is to include exactly those columns
> for which there is an actual need.
>
> One problem I often fight at work is that I want to drop a column, or
> drastically change the meaning of it. I suspect that it is not really
> in use, but still I find a bunch of stored procedures that return this
> column in a result set. But I can also see that these procedures aim
> at returning the universe, so I have no idea whether the value is used
> for something. (Usually, I end up dropping the column anyway.)
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Erland,

In my case, the views only virtualizes the tables. The views must have the
same structure as the table. So if there are colums added to the table, the
view needs to be updated to. In that case, you have the same problem as the
table without view. You want to delete a column but you dont know if it is
used anywere.

What I mean is, declaring the view as select * is exactly what I functional
want. Give me all columns of the table, no matter what columns there are.

So, the statement

SELECT * FROM sometable

comes closer to what I want and what I mean than

SELECT
column1,
column2,
column3,
column4
FROM
sometable

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация