January 14, 2013 at 3:13 am
Hi all,
I have created a batch file to run my SSIS package. I will be able to pass parameters in my batch file such as 20121228 (YYYYMMDD format) I have created a package variable named ExecDate of string type in SSIS. And inside script task i have a line of code as:
Dim runDate As DateTime = Now
now instead of declaring runDate as current datetime, i would like to change it to if ExecDate = "Default", runDate = Now
else
runDate = to the parameter i passed in the batch file.
Note: my ExecDate is of String datatype
Thanks in advance, pros please help
update: i think i have solve the above problem by advising user to only pass in parameters of 2012/12/28 format and using a CDATE function to convert it to date.
January 14, 2013 at 7:58 am
I met with another problem. Lets say using the same package variable ExecDate, data type : String, Default value : "Default"
So if my batch file pass a date parameters to the variable it will used the date pass, else it shall use today date and not the value "Default". How to do this in a Execute SQL task? I got a statement of
Delete From T1 Where creationDate = ?
This wont work as i wont want the value "Default". Any advice? My column creationDate is of datetime type
thanks
January 14, 2013 at 10:12 am
When building a package that allows the user the option of specifying a value for a date variable, I'll set the value of that variable to something unusual, such as 01/01/1899. I'll then use a script task to check that variable to see if it is still set to the default, and if it is, I'll use the current date. If the value is not set to the default, I can assume that a date value has been specified, and I'll use that instead.
hth,
Tim
Tim Mitchell
TimMitchell.net | @tmitch.net | Tyleris.com
ETL Best Practices
January 14, 2013 at 7:40 pm
Hi,
heed your advice i did exactly, and it solved my problem, thanks:)
January 14, 2013 at 10:00 pm
Great! Glad it worked out. Thanks for the follow up.
Tim Mitchell
TimMitchell.net | @tmitch.net | Tyleris.com
ETL Best Practices
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply