Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Function to Convert Current Date to SQL Sever Date format. Expand / Collapse
Author
Message
Posted Tuesday, September 2, 2014 8:04 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 1:49 PM
Points: 4,601, Visits: 4,053
Format the date in SQL Server as a date and use that value in your Oracle query. I cannot remember if Oracle dates will query as SQL Server dates, as it's been way too long since I've worked with Oracle.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1609631
Posted Tuesday, September 2, 2014 8:04 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:41 AM
Points: 7,051, Visits: 7,272
I do not oracle but after a quick google search, try this

SELECT *
FROM OPENQUERY (LS_RDB_DWH, 'SELECT * FROM RDB_DWH.ENTITY_DIMENSION WHERE PD_RDB_ENTRY_DATE >= TRUNC(SYSDATE)')



Far away is close at hand in the images of elsewhere.

Anon.

Post #1609632
Posted Tuesday, September 2, 2014 8:40 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 1:49 PM
Points: 4,601, Visits: 4,053
That should certainly work as long as the query pulls for everything today only. If the requirement is to go back in time, then date math in the Oracle query will suffice. If needed, perhaps the SQL Server procedure could accept a parameter to determine today (0) or days backward in time (integer > 0) and then pick an appropriate Oracle SQL statement to execute.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1609650
Posted Tuesday, September 2, 2014 8:46 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 6:00 PM
Points: 4,041, Visits: 9,189
David Burrows (9/2/2014)
I do not oracle


You're lucky



Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1609653
Posted Tuesday, September 2, 2014 8:49 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Thursday, December 11, 2014 1:06 PM
Points: 4,253, Visits: 4,295
I got the following to work. I tried executing against the table in my original post but it took forever so I cancelled the query.

SELECT CAST(CAE_RDB_ENTRY_DATE as Date), * 
FROM OPENQUERY(LS_RDB_DWH, 'SELECT * FROM RDB_DWHY.ASSOCIATE_ENTITY WHERE CAE_RDB_ENTRY_DATE > TO_DATE(''2014-08-08'',''YYYY.MM.DD'') ORDER BY 1')

Thanks.


For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Post #1609655
Posted Tuesday, September 2, 2014 8:56 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 1:49 PM
Points: 4,601, Visits: 4,053
Why return everything? Don't you just have to know that a row exists with today's date? All you'd have to return is COUNT(*) or some other single value.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1609660
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse