Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 compare date function in sql server and oracle

Author  Topic 

psreee
Starting Member

2 Posts

Posted - 2014-05-07 : 13:43:44
In oracle
((trunc(INF.INFUSION_DTE) - trunc(S.BIRTH_DTE))/365.25) as PATIENT_AGE,



how to write in sql server below columns for minus,

CONVERT(VARCHAR(12),t.event_dte, 111) event_dte,
CONVERT(VARCHAR(12),p.birthday, 111) birthday,

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2014-06-17 : 03:25:02
Use the following

DATEDIFF(day, p.birthday,t.event_dte)/365.25 as PATIENT_AGE,


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -