Click here to Skip to main content
15,885,244 members
Articles / Programming Languages / SQL
Alternative
Tip/Trick

The Evil That is "Select *"

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
25 Jul 2011CPOL 6.1K   1  
I 100% agree with this.Another trick is *if possible* add audit columns at the time of creating/designing the database, i.e.:CreatedOnCreatedByLastModifiedOnLastModifiedByThis could prevent people from using Select *, because generally we don't display such information anywhere, and...

I 100% agree with this.


Another trick is *if possible* add audit columns at the time of creating/designing the database, i.e.:


CreatedOn
CreatedBy
LastModifiedOn
LastModifiedBy

This could prevent people from using Select *, because generally we don't display such information anywhere, and also it will be useful someday to find/fix issues (or atleast you can point a finger at someone).


And for the lazy people, if you want a list of columns from a table with a lot of columns, use SQL Server Management Studio and right click on the table from Object Explorer, and "Select Top 1000 Rows", which will give you the proper Select * From table statement. Modify it and use it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Centramation Systems Pvt. Ltd.
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --