getdate() in parameter
getdate() in parameter
(OP)
I am writing a DTS package to import records from ORACLE which have a date between 14 days from today's date and 28 days from today's date. In the query analyzer, I have no problem setting this up, but it doesn't translage into a DTS package.
How can the SQL statement be set up to allow this kind of parameter to be entered.
How can the SQL statement be set up to allow this kind of parameter to be entered.
RE: getdate() in parameter
2. Are your date ranges always going to be the same, or are you going to have ad-hoc ranges from time to time? If your date ranges are always going to be the same (although a rolling window of time as you have stated), then your best bet is to used equivalent functions in Oracle to SQL Server's GETDATE()/DATEADD, and then code those into your query statically.
3. Are you saying you are using Microsoft SQL Server Query Analyzer to run this query against an Oracle database? If so, I suspect you are using a linked server. It would probably be better to use an Oracle driver in your DTS package and hit the Oracle database directly.
RE: getdate() in parameter
If you're trying to pass a parameter from your package, you need to use VBScript not T-SQL syntax in setting its' value.
OTTOMH, something like DateAdd("d", -14, Date())
If this does not get it done, please post more info on what you are doing.
Hope this helps,
ALex
----signature below----
Majority rule don't work in mental institutions
My Crummy Web Page
RE: getdate() in parameter
RE: getdate() in parameter
----signature below----
Majority rule don't work in mental institutions
My Crummy Web Page
RE: getdate() in parameter
WHERE OC_DT BETWEEN DATEADD(d,14,GETDATE()) AND DATEADD(d,28,GETDATE())
I have tried all sorts of variations on this and none work.
RE: getdate() in parameter
You are going to need to use Oracle syntax.
I know oracle has a dateadd function. Try something like this:
CODE
I'm not sure if Oracle supports CURRENT_TIMESTAMP, but it it's part of the ansi standard so hopefully it does (SQL Server does too, and its' the same thing as getdate()).
I would get in the habit of using CURRENT_TIMESTAMP if you work across systems, because it will work more often than it won't (and I don't know of anything but SQL Server where getdate() works).
HOpe this helps,
Alex
----signature below----
Majority rule don't work in mental institutions
My Crummy Web Page