Converting a script to sql server

fallenangel99

Golden Member
Aug 8, 2001
1,721
1
81
hello,

i have the following script written for oracle and looking to have it work in SQL Server. I looked online and could not find a NUMTODSINTERVAL equivalent for SQL Server


select x,y,

TO_DATE('19700101000000','YYYYMMDDHH24MISS') + NUMTODSINTERVAL((deliveredtime/1000),'SECOND') deliveredtime,

from z
where c order by deliveredtime

deliveredtime is stored as numberic type in SQL Server

Thanks much
 

nickbits

Diamond Member
Mar 10, 2008
4,122
1
81
What are you trying to do? I'm not up on Oracle but should be able to tell you once I know what you are trying to accomplish.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
You're adding an interval expressed as a number of seconds to a date, I think. You can accomplish the same thing using SQL Server's date functions. You'll just have to express the logic a little differently.
 

fallenangel99

Golden Member
Aug 8, 2001
1,721
1
81
Originally posted by: nickbits
What are you trying to do? I'm not up on Oracle but should be able to tell you once I know what you are trying to accomplish.

Hi,

I am trying to convert the number stored in the database to YYYY MM DD HH MM SS format.

Thanks
 

KLin

Lifer
Feb 29, 2000
30,951
1,079
126
So is Delivered time a time unit that needs to be added to 1/1/1970 to come up with the delivered datetime in your specified format?

SELECT DateAdd(ss, DeliveredTime, '1/1/1970') As DeliveredDateTime