SSIS variable not being updated when package is run from SQL Server Agent job
Hi guys,
SSIS2005. I have a user variable that takes the system::StartTime variable and reformats it to a string YYYY_MM_DD_HHnnSS
This variable is then used to append to a series of filenames to identify source files when they are moved from the import directory to the processed directory
Occassionally (and not for all files in the run) the variable seems to be returning the wrong time stamp and will create a time stamp that already exists. This does not appear to be the last time the package was run OR the date the package was last
opened in BIDS.
Can anyone shed any light on what is happening?
May 10th, 2012 1:07pm
when you use System::StartTime variable it will fetch the date time of start of current package, and doesn't return last execution time of package.
you can use SSIS LOGGING to log execution of package and at start of package get latest execution time from the log
OR
use sp_help_jobhistory to get history information of this sql server job (Note that you can use this way only if package runs with sql server agent)
OR
use your own logging, I mean write last execution time of package into a database table at the end of package with a simple Execute SQL Task, and at start of package get latest execution time with another Execute SQL Task and use it to create string YYYY_MM_DD_HHnnSS
as you want.http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
May 13th, 2012 4:35pm
Try: In variable properties use Expression getdate() and set EvaluateAsExpression->true.ESHANI. Please click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
May 13th, 2012 9:56pm