Reply to Re: Select *

Your name:

Reply:


Posted by Erland Sommarskog on 12/06/05 00:34

Trevor Best (nospam@localhost.invalid) writes:
> If you have "select * from table1" in code and drop column2 how is that
> different from having "select column1, column2, column3 from table1" in
> code and dropping column2? (apart from the error ocurring on a different
> line of code of course:-))

The difference is that
1) "SELECT column1, column2..." will bomb. A SELECT * could continue to
work, but yeild incorrect results.
2) If you are using stored procedures, you can use sysdepends to track
whether the column is used, and you would know that it is used. With
SELECT * you don't have an idea.
3) Even if you don't use stored procedure, you can still search the code
for references to the column.


--
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

[Back to original 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

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