Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Preventing usage of "SELECT *..." Expand / Collapse
Author
Message
Posted Wednesday, November 4, 2009 9:44 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, June 15, 2012 7:53 PM
Points: 494, Visits: 299
Comments posted to this topic are about the item Preventing usage of "SELECT *..."

The vision must be followed by the venture. It is not enough to stare up the steps - we must step up the stairs. - Vance Havner
Post #813982
Posted Thursday, November 5, 2009 2:59 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 1, 2014 6:55 AM
Points: 2,366, Visits: 1,845
Interesting but i feel its not practical to add dummy columns to tables.

"Keep Trying"
Post #814090
Posted Thursday, November 5, 2009 3:55 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 5, 2009 3:53 AM
Points: 1, Visits: 0
Another solution that works well in most situations is to simply avoid allowing users to execute SQL statements at all - ensure that all access to tables is performed via stored procedures.
Post #814103
Posted Thursday, November 5, 2009 4:01 AM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 9, 2010 8:36 AM
Points: 2, Visits: 23
We have similiar issues here with the use of *, espically with young developers.

As all our DB projects are under source control, ive been able to control checking in SQL containing * using Code Analysis and Check in policies.

Regards

Gary Howlett
www.garyhowlett.co.uk
Post #814107
Posted Thursday, November 5, 2009 4:25 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, February 13, 2013 12:30 AM
Points: 353, Visits: 487
Indeed a good article but practically difficult to use.

-Forum Etiquette: How to post Performance Problems

-Forum Etiquette: How to post data/code to get the best help
Post #814115
Posted Thursday, November 5, 2009 4:30 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 6:34 AM
Points: 870, Visits: 2,388
In interesting solution, for a not so real problem, as any decent organisation has standards in place and will ensure that all code conforms to the corporate standards.

If not the developer resonsible needs to rewrite the code in line with the standards, they eventually learn that they cant write Selcet * as they have to do double the work.

Besides with the 2008 GDR, you can enforce these at a code entry level.




_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #814119
Posted Thursday, November 5, 2009 5:14 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 17, 2011 4:53 AM
Points: 4, Visits: 51
I think you can still use 'select anyfield, tblname.* from tblname' though.
Post #814135
Posted Thursday, November 5, 2009 5:16 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 1:58 AM
Points: 1,150, Visits: 1,088
I love posts like this. Sure, the specific example used may not be practical, but I just like the thinking behind coming up with the solution. Often that in itself can open up other avenues of thought that would otherwise have remained hidden.
Post #814141
Posted Thursday, November 5, 2009 5:30 AM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, January 9, 2014 1:06 PM
Points: 42, Visits: 56
May not be practical.
May not be standard.

But it is a good/smart solution.



Regards.





Fernando Ponte
factdata.com.br
Post #814153
Posted Thursday, November 5, 2009 5:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, March 17, 2011 4:53 AM
Points: 4, Visits: 51
But it does not solve the problem when I can use

select tblname.* from tblname

with the same result.
Post #814162
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse