ok, to add to this...
the reason this is a pain in the ass for me is because of doing INSERT statements without knowing which columns the user submitted data for.
take this example.
all but fname and last name are optional.
so the query generically looks like this:
insert into table (fname,lname,age,city,state,zip,favfood) values ('abe','bigpants',55,'tempe','az',12345,'ice cream')
the problem is that building this query is done in two parts, the column names, and the values.
if they are string, no problem, since the values would just end up being empty quotes.
but the numbers end up being empty, and as such the query would look like this:
insert into table (fname,lname,age,city,state,zip,favfood) values ('abe','bigpants',,'','',,'')
this obviously blows up because of the ,, for the numeric fields.
so either i wrap every single column in an IF statement, which frankly is rediculous on some of my inserts, which are huge.
I do a "select * from table where 1=0" which opens the table, returning no records, but does return the columns, and doesnt cost much. but the fact is i have never liked that, because I never understood what it really is doing.
im just trying to find a better way.