Database Question
Posted in 1995
Topics: Error Codes & Troubleshooting, Data Types & Schema Design, Migration, Import/Export & Data Conversion
Hi all, I use the unload.ec demo program. I want to add another data type to this program. My table has a data type datetime year to fraction(3). When I do a dynamic sql from that table, the data type return from sqlda is 10 (SQLDTIME). Does any one know how to convert it into characters? I use the function dttoasc() but it doesn't work for me. Thanks much, .. #define FLDSIZE 40 char field[FLDSIZE+1]; char *fieldp; .. for (col = udesc->sqlvar, i = 0; i < udesc->sqld; col++, i++) { switch(col->sqltype) { ....... case SQLDTIME: col->sqltype = CDTIMETYPE; break; ........ } } ....... EXEC SQL FETCH usqlcurs USING DESCRIPTOR udesc; while (sqlca.sqlcode == 0 ) { for (col=udesc->sqlvar, i = 0; i < udesc->sqld; col++, i++) { byfill(field,FLDSIZE+1,0); fieldp = field; switch (col->sqltype) { ....... case CDTIMETYPE: memset(field,' ',FLDSIZE); dttoasc(col->sqldata,field); break; ....... } ......... } Regards, Hoa Bui