You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by Daniel Wenning <Da...@htwg-konstanz.de> on 2019/11/13 09:09:03 UTC

Timestamp can not be converted to TIMESTAMP

Hi,

I am trying to create an UPDATE_TIMESTAMP as version column.

In code i got 
    UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP,    0, true);

and in SQLSERVER i got
    Alter Table Timetable  ADD UPDATE_TIMESTAMP Timestamp;

When trying to insert or update a new entry for Timetable i get the error

INFO  [2019/11/13 09:48]: An Error occured. Message is: The database operation failed. Native error is: Die Konvertierung von "timestamp" in "TIMESTAMP" wird nicht unterstützt.  at org.apache.empire.exceptions.EmpireException.log(EmpireException.java:124) 
org.apache.empire.db.exceptions.EmpireSQLException: The database operation failed. Native error is: Die Konvertierung von "timestamp" in "TIMESTAMP" wird nicht unterstützt.

What is the Error here? 

Thanks in advance!

-- 
Sincerely

Daniel Wenning
8th Semester
Angewandte Informatik
HTWG Konstanz


Re: Timestamp can not be converted to TIMESTAMP

Posted by ivan nemeth <iv...@forumdigital.net>.
Hi Daniel,

Timestamp is not a datetime type in SQL Server, it's a synonym for
rowversion which is a incrementing number for versioning. See
https://docs.microsoft.com/en-us/sql/t-sql/data-types/rowversion-transact-sql?view=sql-server-ver15

You should use datetime2:

 Alter Table Timetable  ADD UPDATE_TIMESTAMP *datetime2*;


Regards,
Ivan


On Wed, Nov 13, 2019 at 10:09 AM Daniel Wenning <
Daniel.Wenning@htwg-konstanz.de> wrote:

> Hi,
>
> I am trying to create an UPDATE_TIMESTAMP as version column.
>
> In code i got
>     UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP,
> 0, true);
>
> and in SQLSERVER i got
>     Alter Table Timetable  ADD UPDATE_TIMESTAMP Timestamp;
>
> When trying to insert or update a new entry for Timetable i get the error
>
> INFO  [2019/11/13 09:48]: An Error occured. Message is: The database
> operation failed. Native error is: Die Konvertierung von "timestamp" in
> "TIMESTAMP" wird nicht unterstützt.  at
> org.apache.empire.exceptions.EmpireException.log(EmpireException.java:124)
> org.apache.empire.db.exceptions.EmpireSQLException: The database operation
> failed. Native error is: Die Konvertierung von "timestamp" in "TIMESTAMP"
> wird nicht unterstützt.
>
> What is the Error here?
>
> Thanks in advance!
>
> --
> Sincerely
>
> Daniel Wenning
> 8th Semester
> Angewandte Informatik
> HTWG Konstanz
>
>