[Tutor] database question

Alan Gauld alan.gauld at btinternet.com
Sat Oct 28 01:14:39 CEST 2006


> For example
> with "SELECT * FROM a", I use this code
>
> ... to know how many columns are in the result,

As a general rule its better to avoid "Select * From" in production 
SQL.
If the table definition changes the data returned can change in 
unexpected
ways and break your application. In addition you can wind up sucking
up an awful lot of unnecessary data (think bandwidth and server 
throughput).
Its much safer to  explicitly list all of the columns you want to pull 
back
if at all possible.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list