DB2 CURRENT TIMESTAMP - ERROR [22003] [IBM] [CLI驱动程序] CLI0111E数值超出范围。 SQLSTATE = 22003

时间:2015-10-09 20:35:29

标签: c# sql timestamp db2 odbc

我正在尝试插入DB2表。

OdbcConnection db2Connection = new OdbcConnection();
db2Connection.ConnectionString = "Dsn=DB2T;Driver={IBM DB2 ODBC DRIVER};uid=xxxxxxx;pwd=xxxxx;Regional=No";

OdbcDataAdapter daDB2 = new OdbcDataAdapter();
OdbcCommand insertDB2HourlyCommand = db2Connection.CreateCommand();

string sqlInsert = "INSERT INTO " + tableName +
                               + @" VALUES (?, ?, ?, ?, ?, ?,
                                            ?, ?, ?, ?, ?, ?,
                                            ?, ?, ?, ?, ?, ?)";

One of these parameters is a TIMESTAMP field, which I have tried various methods to insert CURRENT TIMESTAMP...

insertDB2HourlyCommand
    .Parameters
    .Add("@ROW_TS", OdbcType.VarChar)
    .Value = "CURRENT TIMESTAMP";

insertDB2HourlyCommand
    .Parameters
    .Add("@ROW_TS", OdbcType.Timestamp)
    .Value = ("TO_TIMESTAMP('2015-10-09 13:43:00.578073'), 'YYYY-MM-DD HH24:MI:SS.FFFFFF')");

我不断收到的错误消息是

  

错误[22003] [IBM] [CLI驱动程序] CLI0111E数值超出范围。 SQLSTATE = 22003。

我尝试过使用OdbcType和参数值无效。我的想法已经不多了。

0 个答案:

没有答案