Highlighted

SQL2 String to Date

Avatar

Avatar

tim-schwalbe-NZ

Avatar

tim-schwalbe-NZ

tim-schwalbe-NZ

27-11-2017

Hello I want to ask if it is possible to convert a String to Date, because its is not possible to change the datatype to date because production data can't be changed easily.

Here is my first try but it does not work as expected:

SELECT * FROM [nt:unstructured] as ref WHERE ISDESCENDANTNODE(ref,[/content/jobs/jcr:content/jobData]) AND ref.Function='Legal'

AND ref.date >= CAST('07-07-2017' AS date)  ORDER BY ref.date ASC

After converting it I want to order the nodes by the date.

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

27-11-2017

This subject is discussed here - JCR SQL2 query comparing dates - Stack Overflow

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

27-11-2017

ALso - if you cannot cast and sort by a cast operation - then write sort logic using Java.