Re: Binary(250) Primary Key
Posted in 1998
The data is binary (may contain embedded zeros, maybe even leading zeros). It's not a NULL terminated string so I don't want to truncate at the first NULL. Also the data is variable length, usually 45 bytes but can be up to 250 bytes. I have other small binary columns (20 bytes) as well. When I try to INSERT a row into the table, INFORMIX complains: '[INTERSOLV][ODBC Informix driver]This is either an Unknown Type or is not supported currently. Error in parameter 3.' This may be because the code "knows" the field is binary. On the SQLBindParameter(..) call I specify SQL_C_BINARY and SQL_VARBINARY. This works on DB2, Oracle8, and Sybase, so I really don't want to change the data type in the code. Isn't there a way to define binary data in Informix other than BYTE? BYTE is no good because I can't use it as a primary key. Also, I've tried defining the 20 byte fields as BYTE and VARCHAR(20) but both yield the same message from Informix about the unknown type. Any ideas? Thanks, Jim Blye __________________________________________ Art S. Kagel wrote: > Birdman wrote: > > > > Hi, > > Use varchar(250). > > Varchar is no good. The column will truncate on insert at the first > NULL byte. However CHAR(251) will work the extra byte is to insure > that the first byte is not NULL in which case the engine will consider > the column as containing a NULL for that row. If you insert the key > with the same leading, non-zero, byte the key ordering and indexing > will not be affected. > > Art S. Kagel