Srinivasa Senapathi
Srinivasa Senapathi

Reputation: 11

orientdb set date value to vertex fails

OrientDB update statement fails.

Below update statement to update the date on vertex fails.

Update VertexA SET UpdatedDate = "2018-09-18" where @rid=#27:0

Tried couple of other options with asDate() and date() function as shown below but no luck.

Update VertexA SET UpdatedDate = "2018-09-18 00:00:00" where @rid=#27:0

Update VertexA SET UpdatedDate = "2018-09-18".asDate() where @rid=#27:0

Thanks in advance for any help.

Upvotes: 0

Views: 100

Answers (1)

Srinivasa Senapathi
Srinivasa Senapathi

Reputation: 11

There are two things to note here.
1. We have to set the Date format at the database using the following syntax.

ALTER DATABASE DATEFORMAT "yyyy-MM-dd"

After this statement was run, everything works fine.

  1. In other vertex/edges I had date column name as From and To. These column names were not working. It seems they are conflicting with OrientDB key words.

Solution : Change the column name and to something like FromDate and ToDate. It started working.

If you would like to use the column names as From and To then you have look/search for the documentation of OrientDB to see if they provide any escape char to allow the keywords to be used as column names. In MS SQL You can use the Key words as column names with in the square brackets [] ex: [Description]

I hope this is useful for other developers.

Upvotes: 1

Related Questions