Package date
Table 1
Id loanamout startdate enddate
Package is created taking 9hr to run ,want to update startdate and enddate of table1 .When package start running ,need that date come into startdate and when package finish running need to enter that date .We can use getdate for this but let me know
where in package to include this.
December 27th, 2010 10:49pm
use Event Handlers
in the first task of your SSIS package, create an EventHandler for OnPreExecute
and put a script task in the event handler, you can set startDate variable there.
for this, use should set User::StartDate variable as ReadWriteVariables in script task editor, then write this line in main() method:
Dts.Variables("User::StartDate").Value=DateTime.Now
in the last task of your SSIS package, create an EventHandler for OnPostExecute
and put another script task there, you can set EndDate variable there.
for this, use should set User::EndDate variable as ReadWriteVariables in script task editor, then write this line in main() method:
Dts.Variables("User::EndDate").Value=DateTime.Nowhttp://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
December 27th, 2010 11:31pm
Reza a slight correction to what you said. Instead of Script task Mike just use an Execute SQL Task and insert or update the record using SQL Query.
Tweet me..
December 28th, 2010 12:31am
Thanks.Can you tell me little more because package is big .What would be the sql statement inside execute sql task ,may be like this
Insert into Table1(startdate) values(getdate())
Same for enddate
Free Windows Admin Tool Kit Click here and download it now
December 28th, 2010 9:58am
I got it ,but do we need to create StartDate and EndDate variables and pass to script task same variable as an input and output please let me know.
December 28th, 2010 10:02am
I got it ,but do we need to create StartDate and EndDate variables and pass to script task same variable as an input and output please let me know.
not sure what you mean by this. Are you using execute SQL task or Script task?
Tweet me..
Free Windows Admin Tool Kit Click here and download it now
December 28th, 2010 11:34am
Execute sql task ,in this do we need to write this after configuring event handler
Insert into Table1(startdate) values(getdate())
December 28th, 2010 12:17pm
if you want to just insert StartDate into table1,
so add an execute sql task as first task of your ssis package, then write this statement in sqlstatement property:
Insert into Table1(startdate) values(getdate())
you can do same for EndDate with an execute sql task at the end of package.http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
December 28th, 2010 12:28pm