GUID key types
Posted in 1999
Topics: Connectivity: ODBC / JDBC / .NET, Triggers, Constraints & Referential Integrity
I use GUID's (Globally Unique IDentifiers are 128-bit integers generated through Win32 system calls) for primary (and thus) foreign keys in database applications. My primary database interface is ODBC and it supports a GUID parameter type to allow applications to insert these values into tables. SQL-Server 7 has a native type which corresponds to GUID's. My question is if Informix supports GUID's. They can be represented by 32-character strings but I would like to know if Informix allows me to store them in some binary form which can be used in indexes and querie conditions. TIA Silvio Bierman
Hi! You can store these in a CHAR column. In Informix, a CHAR column can contain any 8-bit binary value, with 1 exception: The first byte cannot be 0 (as this is how Informix indicates a NULL column). So if you put "dummy" value in the first position of the column (I usually put an X there, but you can put whatever you like...), you should be able to fit this into a CHAR(17) column. If you use ESQL/C, you cannot use a char * for this (as the API will think that a ASCII 0 in there is the string terminator), but you can use a fixchar[17]... I've havent tested this recently.... Karlsson Silvio Bierman wrote: > I use GUID's (Globally Unique IDentifiers are 128-bit integers generated > through Win32 system calls) for primary (and thus) foreign keys in database > applications. > My primary database interface is ODBC and it supports a GUID parameter type > to allow applications to insert these values into tables. > > SQL-Server 7 has a native type which corresponds to GUID's. > > My question is if Informix supports GUID's. They can be represented by > 32-character strings but I would like to know if Informix allows me to store > them in some binary form which can be used in indexes and querie conditions. > > TIA > > Silvio Bierman
Silvio Bierman wrote: > > I use GUID's (Globally Unique IDentifiers are 128-bit integers generated > through Win32 system calls) for primary (and thus) foreign keys in database > applications. > My primary database interface is ODBC and it supports a GUID parameter type > to allow applications to insert these values into tables. > > SQL-Server 7 has a native type which corresponds to GUID's. > > My question is if Informix supports GUID's. They can be represented by > 32-character strings but I would like to know if Informix allows me to store > them in some binary form which can be used in indexes and querie conditions. Informix's DECIMAL type can represent up to 32 decimal digits of precision and can be fixed point or floating point. 128 bit integers may contain 38.1 decimal digits or you could break the integer into two or four smaller fields. Art S. Kagel