I want to run this issue by those who know more about PL/SQL and T-SQL than I do. Below is some code that I inherited and it’s returning dates that are 1 hour off. When I remove the “to_char(i.UPDATE_DT, ”YYYY-MM-DD HH24:MI:SS.FF3”)” in the select statement of the remote query the hour offset goes away. I’m worried about other impacts this change could have, so my question is why would someone convert an Oracle time to a string via an OpenQuery and then use T-SQL convert in the select statement? What am I missing here and why would the to_char cause an offset (if it is the reason)?
SELECT
CSE_ID AS ID,
OTHR_CSE_ID AS Case_Num,
convert(datetime,UPDATE_DT,121) AS Export_Time
FROM
OpenQuery( OracleTbl, '
SELECT c.CSE_ID, r.OTHR_CSE_ID, to_char(i.UPDATE_DT,''YYYY-MM-DD HH24:MI:SS.FF3'') UPDATE_DT
FROM AE_CSES c
INNER JOIN CSES i ON i.CASE_ID = c.CSE_ID AND i.ACTION_CD = ''INS''
INNER JOIN OTH_CSE_REFS r ON r.CSE_ID = c.CSE_ID AND r.OTH_CS_REF_SEQ_NBR = 1 AND r.OTHER_SOURCE_TYPE = ''SIE''
') AS i
Simplistic answer but; Daylight savings issue between one server and the other?