我从oracle获取昨天的数据时遇到问题 我使用OPENQUERY从oracle获取数据,如下所示:
IF OBJECT_ID('tempdb..#Temp') IS NOT NULL
DROP TABLE #Temp
SELECT [TXT_TICKETNUMBER] AS [TICKET_NUMBER]
,CAST(lead(convert(varchar,convert(datetime,'01-JAN-1970 03:00:00',120) + [DAT_CLOSEDATE]/(24*60*60), 120),1,convert(varchar,convert(datetime,'01-JAN-1970 03:00:00',120) + [DAT_CLOSEDATE]/(24*60*60), 120)) over(partition by [TXT_TICKETNUMBER] order by [DAT_CLOSEDATE])AS date) AS [CLOSE_DATE]
INTO #Temp
FROM OPENQUERY(RUHRTTSDB, 'SELECT * FROM ARADMIN.RTTS_HPD_TROUBLETICKET')
WHERE [DAT_CLOSEDATE] = SYSDATE - 1