Forum Discussion

OOTesting's avatar
OOTesting
Occasional Contributor
8 years ago
Solved

How to include datetime in a groovy sql query

I am new to groovy scripting, I am attempting to run this simple query, that will return a count which is then used in a compare.

 

The query is below:

 

row = sql.firstRow('SELECT count(*)  FROM [DB].[dbo].[view] where LastUpdated > \'2016-06-18 03:04:02.550\')

 

Whenever I run the query it will return the error message below:

 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script14.groovy: 9: expecting ''', found '\n' @ line 9, column 137. > \'2016-06-18 03:04:02.550\') ^ org.codehaus.groovy.syntax.SyntaxException: expecting ''', found '\n' @ line 9, column

 

Any ideas as to what I doing wrontg?

3 Replies