SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Function to Convert Current Date to SQL Sever Date format.


Function to Convert Current Date to SQL Sever Date format.

Author
Message
Ed Wagner
Ed Wagner
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16565 Visits: 10061
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
David Burrows
David Burrows
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: General Forum Members
Points: 9544 Visits: 9751
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.


Ed Wagner
Ed Wagner
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16565 Visits: 10061
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
Luis Cazares
Luis Cazares
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16410 Visits: 19084
David Burrows (9/2/2014)
I do not oracle


You're lucky :-D


Luis C.
General Disclaimer:
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?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Welsh Corgi
Welsh Corgi
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10150 Visits: 4894
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/
Ed Wagner
Ed Wagner
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16565 Visits: 10061
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search