File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to insert a data of datetype timestamp into Sqlserver2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to insert a data of datetype timestamp into Sqlserver2000" Watch "How to insert a data of datetype timestamp into Sqlserver2000" New topic
Author

How to insert a data of datetype timestamp into Sqlserver2000

Welsh Ding
Greenhorn

Joined: Dec 29, 2003
Posts: 14
In sqlserver2000,a table have a column is datatype timestamp,I used these mothed to insert a record:
1.insert tableName values (CURRENT_TIMESTAMP);
error:
Disallowed implicit conversion from data type datetime to data type timestamp, table 'eServices.dbo.SMS_COMMENTARIES_USER_LOGS', column 'UPDATE_DATE'. Use the CONVERT function to run this query.

2.insert tableName values ('1998-12-31 12:30:00');
error:
Disallowed implicit conversion from data type varchar to data type timestamp, table 'eServices.dbo.SMS_COMMENTARIES_USER_LOGS', column 'UPDATE_DATE'. Use the CONVERT function to run this query.
3.insert tableName values (GETDATE());
error:
Disallowed implicit conversion from data type datetime to data type timestamp, table 'eServices.dbo.SMS_COMMENTARIES_USER_LOGS', column 'UPDATE_DATE'. Use the CONVERT function to run this query.
How to insert a data of datetype timestamp into Sqlserver2000? thanks in advance!


Welsh<br />SCJP 1.4
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
hi:
I am not sure of the answer, but you might want to try this:
use java.sql.Date instead if java.util.Date


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert a data of datetype timestamp into Sqlserver2000