Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expression syntax DateDiff 1

Status
Not open for further replies.

ksaab2002

MIS
Jan 6, 2005
66
US
I know this topic has had a lot of coverage so if I am re-iterating forgive me. I have tried solutions from other threads with no result..

I am using CR9 - I am trying to create a SQL expression that finds the difference in days between two datetime fields..I am getting errors and think it is due to syntax. Any suggestions appreciated!

Thanks!
 
Since you specifically said SQL expression, I take it that datediff is out of the question. However, you did not mention what database you are using. The following SQL expression should work in Oracle.

(to_date({table.date1})-round({table.date2})

Cheers,
-LW

 
When using SQL Expressions, the type of database will determine the syntax, but usually, the arguments are:

DateDiff(IntervalType, StartDate, EndDate)

For instance, if using SQL Server, and you want the difference in minutes, the SQL Expression would be:

DATEDIFF(MINUTE, Table.Date1, Table.Date2)

-dave
 
I thought so, I was getting an error but it has resolved. Thanks !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top