I am a new user to SQL and just want to know how to search between two dates using the column DOCUMENT.CLINICALDATE. Thanks
Here's one of my scripts with an example of how I do it. You should be able to say something like (Expr1 > CONVERT(DATETIME, '2015-10-10 00:00:00', 102)) and (Expr1 CONVERT(DATETIME, '2015-10-10 00:00:00', 102))
Julie
Did the script part get deleted? Can't see it.
SELECT dbo.Convert_ID_to_date(CLINICALDATE) AS Expr1, SUMMARY, STATUS, DB_CREATE_DATE
FROM [DOCUMENT]
WHERE (DOCTYPE = 25) AND (DB_CREATE_DATE > CONVERT(DATETIME, '2015-10-10 00:00:00', 102))
Alas, ClinicalDate is the number of seconds from 01/01/1960, padded on the right with 6 zeroes. If you want to convert ClinicalDate to a date, the SQL code looks like this:
dateadd(day,convert(int,(clinicaldate/1000000/3600/24)),'01/01/1960')
This is perfect! Thank you