OHDSI Home | Forums | Wiki | Github

[DatabaseConnector] executeSql() with a DATEADD()?

We have SQL Server and I’m trying to pass SQL code that has gone through renderSQL() into executeSql(). Part of my SQL is the following:

WHERE co.CONDITION_START_DATE BETWEEN DATEADD(dd,-60,c.INDEX_DATE) and c.INDEX_DATE

When I writeLines() and grab the rendered SQL and run it in SSMS it runs fine, but when I run it using executeSql() it returns no rows. If I replace the dateAdd() with a real date I can get rows.

Does anyone know if executeSql() is doing something funny with the dateAdd()?

@Chris_Knoll, @schuemie or @Patrick_Ryan have you already delt with this?

Blah, restarting my R session caused this now to work. :expressionless: I can no longer reproduce the error.

t