Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    6

    Question Unanswered: SQL Server TimeStamp Data type Problem in pst.setNULL() in case of paramatrized que

    I would like to get information related to timestamp data type in SQL Server (WANT TO SET NULL IN TIMESTAMP COLUMN )I have Following case

    try {
    try {
    stmt.execute("drop table timestampTable");
    }
    catch (SQLException ex1) {
    }
    stmt.execute(
    "Create table timestampTable(c1 int Primary Key, c2 Timestamp)");

    PreparedStatement pst = connection.prepareStatement(
    "insert into timestampTable values(?,?)");
    pst.setInt(1, 2);
    pst.setNull(2, Types.TIMESTAMP);
    pst.execute();
    }
    catch (SQLException ex) {
    ex.printStackTrace();
    }


    TRACE IS GIVEN BELOW
    ====================


    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Disallowed implicit conversion from data type datetime to data type timestamp, table 'ClientDB.dbo.timestampTable', column 'c2'. Use the CONVERT function to run this query.
    at com.microsoft.jdbc.base.BaseExceptions.createExcep tion(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.proces sErrorToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.proces sReplyToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.pro cessReplyToken(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.proces sReply(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplStatemen t.getNextResultType(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.commonTransi tionToState(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.postImplExec ute(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.post ImplExecute(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.commonExecut e(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.executeInter nal(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.exec ute(Unknown Source)
    at JDBC.TestSQLServer.testTIMETAMPDataTypes(TestSQLSe rver.java:75)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.daffodilwoods.tools.testworker.TestRunner.runM ethod(TestRunner.java:159)
    at com.daffodilwoods.tools.testworker.TestRunner.runI nSequence(TestRunner.java:83)
    at com.daffodilwoods.tools.testworker.TestRunner.runT estCase(TestRunner.java:4


    PLEASE REPLY ME AS SOON AS POSSIBLE

    THANKS

    SUBE SINGH

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Posted in wrong forum - I will move to SQL Server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •