|
|||
|
On Thu, Aug 16, 2012 at 2:04 AM, Francesco Alfano <edacedpa@yahoo.it> wrote:
> How can I determine, in ESQL, the datatype of the columns in a table > without first using a SELECT statement? > > I'm looking for a sample code that implements a statement like "INFO > COLUMNS FOR ..." > You have somewhat limited options. You can SELECT the information from SysColumns; you can PREPARE and DESCRIBE a SELECT statement for the table. Since both those use SELECT, they might be verboten by your rules. That leaves you with PREPARE and DESCRIBE of an INSERT statement or an UPDATE statement; there isn't an easy way to twist a DELETE statement into providing the information; I suppose there might be a way to do it with MERGE, too, but I'm not sure of that. For built-in types, the code in sqltype.ec in the SQLCMD package available at the IIUG does a decent job of taking coltype and collength (from syscolumns) and producing the correct type information. For UDRs, you will need to look elsewhere, and use the extended ID information from SysColumns. (Note that DESCRIBE returns the information from SysColumns.) -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." |
|
|
||||
|
||||
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|