Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have a ssis package which runs daily. This ssis package has couple of execute sql tasks which load data for yesterday's transaction. Ex.

INSERT INTO Shipped
(Div_Code, shipment_value, ship_l_id, shipped_qty, shipped_date, whse_code,

ord_id, ship_id, ship_l_ord_l_id, Created_date)
select ord.DIV_CODE as div_code, ship.SHIPMENT_VALUE as shipment_value, ship_l.SHIP_L_ID as ship_l_id,
ship_l.SHIPPED_QTY as shipped_qty, ship.SHIPPED_DATE as shipped_date, ship.WHSE_CODE as whse_code,
ord.ORD_ID as ord_id, ship.SHIP_ID as ship_id, ship_l.ord_l_id as ship_l_ord_l_id, Getdate() as Created_date
from SHIP ship, ORD ord,
SHIP_L ship_l
where ship.SHIPPED_DATE=(dateadd(day, -1, CONVERT(VARCHAR(10),GETDATE(),120))) and ship.WHSE_CODE='WPP' and ord.ORD_ID=ship.ORD_ID
and ship.SHIP_ID=ship_l.SHIP_ID


All execute sql task has query like above query. and in some query we have date filter which loads data for yesterday. Ex. one query has ship.SHIPPED_DATE=(dateadd(day, -1, CONVERT(VARCHAR(10),GETDATE(),120))). some other query has ord.trans_date=(dateadd(day, -1, CONVERT(VARCHAR(10),GETDATE(),120))). this package runs daily through sql server job, so It loads data for yesterday. Now If i want to run for any particular date, How could we achieve from ssis? I am very new to SSIS. Could anyone guide me to achieve this?

Thanks in advance
Posted
Updated 18-May-15 23:30pm
v3
Comments
Mantu Singh 19-May-15 5:48am    
Simple edit the query like date='2015-05-19'
Member 10833473 19-May-15 7:49am    
Thanks Mantu for your reply,
But i have 12 execute task like this, So I have to change everywhere. Instead of changing in query, can we achieve through parameters in SSIS. Suppose we want to load for may 9th. So how can we pass this date as a parameter?

1 solution

There's a decent explanation of how to do this on the Simple Talk blog:
https://www.simple-talk.com/sql/ssis/passing-variables-to-and-from-an-ssis-task/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900