All Forums Connectivity
piotrs 10 posts Joined 08/09
07 Aug 2009
[ODBC] Inserting null value for TIMESTAMP column, using arrays of parameters


I've a problem when inserting null value to TIMESTAMP column. I use arrays of parameters and insert two rows with one statement. I receive error when executing statement: "Invalid timestamp".

Problem occurs only when one row has value and other is null. If two has value or are null, then problem doesn't occur. There is no problems in similar situation with another data types (e.g. VARCHAR, INTEGER).

Here is my code (without error handling etc.):


SQLPrepare(hstmt, (SQLCHAR*)"INSERT INTO Limity(trzy, piec, szesc) VALUES('123', 'abcde', ?)", SQL_NTS);

SQLSMALLINT sqlDataType, decDigits, nullable;
SQLDescribeParam(hstmt, 1, &sqlDataType, &size, &decDigits, &nullable);


tsStruct[1].year = 2008;
tsStruct[1].month = 8;
tsStruct[1].day = 3;
tsStruct[1].hour = 0;
tsStruct[1].minute = 0;
tsStruct[1].second = 0;
tsStruct[1].fraction = 0;

lenInd[0] = SQL_NULL_DATA;
lenInd[1] = 0;

SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, sqlDataType, size, decDigits, tsStruct, 16, lenInd);


This work fine with MS SQL Server. Maybe this is driver bug?

vhari 111 posts Joined 12/08
11 Aug 2009

What version Teradata ODBC Driver you are using ?

piotrs 10 posts Joined 08/09
11 Aug 2009

I'm connecting to Teradata Express Edition 12.0 using ODBC driver

vhari 111 posts Joined 12/08
24 Aug 2009

ODBC driver version has fix for this problem.

piotrs 10 posts Joined 08/09
25 Aug 2009

I can't see such version here:

Did you mean

piotrs 10 posts Joined 08/09
26 Aug 2009

OK, after logging in I find it. It helped, thank you!

You must sign in to leave a comment.