x

Oracle to SQL

Hello. I am new in Oracle. I need data copy from Oracle DB to SQL server. When I am using WHERE statement DRAW_DATE BETWEEN TO_DATE('08/05/2013','mm/dd/yyyy') AND TO_DATE('09/29/2013','mm/dd/yyyy') I have no problem, but I need to run SSIS package each week and date will change each time. What should I use instead? Please help. Thanks.

more ▼

asked Oct 02, 2013 at 01:26 PM in Default

avatar image

innap9999
38 7 9 12

(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first

How about creating a varible at the top of the t-sql code for the SSIS package the changes the date accoringly? Something like.

DECLARE @startdate DateTime DECLARE @enddate DateTime

SET @startdate = getdate() SET @enddate = getdate()

Then determine the intervals. Every day, every week...and change the variables in the WHERE clause

DRAW_DATE BETWEEN TO_DATE(@startdate) AND TO_DATE(@enddate)

more ▼

answered Oct 02, 2013 at 01:43 PM

avatar image

sqlaj 1
5.5k 4 6

Thank you, I will do it. You Helped me a lot.

Oct 02, 2013 at 02:28 PM innap9999
(comments are locked)
10|1200 characters needed characters left

In SSIS there are system and user variables. These are different than script variables. See http://technet.microsoft.com/en-us/library/ms141085.aspx to get you started. Yes user variables can do exactly what you want. You can find a good beginners tutorial on SSIS and variables here: http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/99287/ It also goes through other things, but what you're looking for is there.

more ▼

answered Oct 03, 2013 at 08:09 PM

avatar image

dvroman
1.1k 1 4 4

(comments are locked)
10|1200 characters needed characters left

Sorry, but I cannot DECLARE and SET variables in that t-sql - it give me errors. I tried to create variables in SSIS, but I don't know how to do so..

more ▼

answered Oct 02, 2013 at 06:46 PM

avatar image

innap9999
38 7 9 12

(comments are locked)
10|1200 characters needed characters left

I don't work with SSIS that much so I am not sure about how to use variables. I do know there are script tasks and I think that you can execute T-SQL code but again, not really sure how to set it up.

I am not sure if this will help but you may want to look through it for guidance. http://technet.microsoft.com/en-us/library/ms135941.aspx

more ▼

answered Oct 03, 2013 at 11:07 AM

avatar image

sqlaj 1
5.5k 4 6

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1114
x434
x41

asked: Oct 02, 2013 at 01:26 PM

Seen: 885 times

Last Updated: Oct 07, 2013 at 10:13 AM

Copyright 2017 Redgate Software. Privacy Policy