Re: Is there a better way to prepare an Insert?
Posted in 1998
Daniel Wright wrote: > I guess this is what I really should do...however I'm embarassed to > say how many > columns this table has (not that I had anything to do with that, so > I'll tell you. 172). > Anyway, I also thought this one up after I posted....I could > dynamically build > my prepare by doing a select count(*) on syscolumns for that > table....Still, it > almost seems easier to let the thing break and fix it when it does, > but that's > the wrong thing to do. [Original message SNIPPED] You could PREPARE and DESCRIBE a "SELECT * FROM <tablename>" and use the information from the sqlda structure or SQL DESCRIPTOR area to a) create the INSERT statement and b) USING that descriptor int the INSERT or PUT statements to attach the data inputs and decode the incoming data. After all if you do not know at compile time what the table might look like, how can you know what the inputs look like? This method assumes that the inputs match whatever the current table structure is, but, that should always be do-able. Art S. Kagel