troubleshooting Question

Converting sas date into SQL server

Avatar of elucero
elucero asked on
Microsoft SQL ServerSQL* sasl
12 Comments1 Solution50 ViewsLast Modified:
I'm trying to convert the following dates into sql from sas, both are coming up incorrect.  Any suggestions?

CASE WHEN date_of_birth <0 THEN DATEADD(ss,21914,CAST(ABS(date_of_birth) AS DATETIME))
ELSE DATEADD(ss,1893369600,CAST([date_of_birth] AS DATETIME) ) END as BirthDate
date_of_birth in('-58438','2647911')

date_of_birth   result
-58438             2059-12-31 06:05:14.000
2647911          9209-09-25 00:00:00.000

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros