Passing a dynamic date to Oracle using SSIS
Hi,
I am struggling to carry out what would appear to be a straighforward task. I have relatively no experience using SSIS apart from a 3 day course on BIDS - so hopefully someone can help me!
My ultimate goal here is to create a daily extract which will return 24 hours of data from an Oracle DB table into a SQL table.
Ideally what I need to happen is to run a task to check the date/time of the last record whch was imported from the last extract....however, to start off I thought I would just try pulling a date range back.
I have created an OLE DB Source data flow task - The OLEDB connection manager links thorugh to the server fine, and if I try passing the query through without a where clause all data is returned.
e.g.
SELECT mycolumn
FROM my table
I tried passing various date formats through and the only format which returned a valid data set was DDMONYYYY
SELECT myColumns
FROM myTable
WHERE StartTime >= '09-Mar-2011'
So I guess what I need to do is create a variable which is created dynamically in this format then call the variable in my code?
I have viewed some similar posts which indicate to assign as a variable.
I have tried assigning a variable, tried creating the entire SQL script as a variable but seem to be getting nowhere. Is there a solution out there someone can point me to?
note that the Oracle StartTime column consists of a date and time
Any help would be much appreciated - I have been looking at this for 3 days now and I'm slowly going crazy!
Thanks
AD
March 10th, 2011 10:18am
Did you try using the parameter option of the OLEDB Source? Ex: Select <> from table where date<? and then using the parameter option to pass the parameter. Also, consider using the date format as : YY-MM-DDNitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2011 10:26am
Thanks for your post Nitesh
I tried using a paremeter, however I recieved an error message "Provider cannot derive parameter information and SetParameterInfo has not been called (Microsoft OLE DB for Oracle)"
Using YY-MM-DD appears to return no rows, the date is automatically converted to DD-MM-YY - do I need to format the date using a funciton?
I tried assigning a variable with some code I found
(DT_WSTR,4)YEAR(GETDATE()) + "-"
+ RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) + "-"
+ RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2)
this returns YYYY-MM-DD in the variable, but when I try to assign it to the query no rows are returned.
March 10th, 2011 11:21am