Issue of dynamically setting query for datareader source
Hi all, I am new to SSI.I am having a requirement like to transfer the data from my mysql databse to sql database .I need to execute a procedure to get this data from mysql databse I have done the following things. 1)created a connection manager by creating a DSN in odbc 2)Added one dataflow task in which i used datareader as the datasource and sqlserver destination as the destination 2)Tried with a simple select statement and am able to transfer data between these two databses Issues am facing now is 1) I couldnt execute the stored procedure in datareader 2)I need to pass parametrs to sql command myprocedure('2011-02-15 00:00:00' and '2011-02-15 23:59:59').I need to pass this variables based on the current date.I have created 2 variables in SSIS and setted the value for this variables like this DateFrom: (DT_WSTR,4)YEAR(GETDATE()) + "-" + RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) + "-" +"00:"+ " " + "00:"+" " +"00" DateTo: DT_WSTR,4)YEAR(GETDATE()) + "-" + RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) + "-" +"23:"+ " " + "59:"+" " +"59" Here i need to check one condition before setting the DateFrom variable.Suppose the day is MOnday i need to take the DateFrom as last saturday's date. Can anyone help me please!!! Thanks Jeena
February 15th, 2011 5:04am

Hi, You can implement DATEPART function to determine what week day is,,, per example: DATEPART(dw,GETDATE()) < 6 Only a thing that you should know is what is the first day of week in your regional settings. In my case, the first of a week day is monday, then i can filter less than 6 to get work days of week.Vctor M. Snchez Garca (ES) (BI) Hope this help. Please vote if you find this posting was helpful. if this is an answer to your question, please mark it. |
Free Windows Admin Tool Kit Click here and download it now
February 15th, 2011 5:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics