Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.* > Newsgroup comp.databases.informix

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-16-2012, 03:27 PM
Jonathan Leffler
Guest
 
Posts: n/a
Default Re: Determining the Datatype of a Column

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."

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 03:08 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.