Last post Nov 23, 2018 07:47 PM by mmazeemahmad
Nov 23, 2018 05:28 PM|mmazeemahmad|LINK
I have a same query which if runs on Oracle gives the succeeding results:
While the same query with same database structure if run in SQL gives the following results:
All i need is the SQL results must be the same as the results given by oracle which is not date but few decimal values like '0.31512121515405145154'
Can someone please advise..
Nov 23, 2018 06:20 PM|PatriceSc|LINK
This is the same value handled differently :
Now how to best solves this depends on the situation. You are trying to write an application that supports both Oracle and SQL Server with the same queries or this is a one time port from one to the other ?
It seems this ciolumn could be exposed as a double for Oracle and maybe as a DateTime for SQL Server (likely because the lack of a real "Duration" type). If confirmed you could try to normalize this difference on the db side but the simplest option could be
to move this calculation to the client side where you'll always get a TimeSpan.
Nov 23, 2018 07:00 PM|mmazeemahmad|LINK
Its going to be one time job as we are switching from oracle to SQL permanently, so no need to handle both situations,
Also we would like to handle this situation on db side so can you please advise how i can change my sql query to get the same result as of oracle and which you explained very well as well.
Nov 23, 2018 07:47 PM|mmazeemahmad|LINK
I got the solution i changed my query to the following to get the desired result,,,,,
select id_numeric, RECD_DATE, DATE_COMPLETED, datediff(second, RECD_DATE, DATE_COMPLETED)/ (86400.00000000000) from sample