how to pass a varible
Hi all,
I am downloading .csv file from https site using Script task with help of C# code into "C" drive.
myConnection.DownloadFile(
"c:\\temp\\new\\sme.csv",
true);
Then loading data from that(.csv) file into my staging table. this is ok on DEV server..but when i moved to production i don't have access to C drive so i am not able to load data into my staging tables. so i want to create a varible for path in Script
task to get control over the script task and then taht varible can be set by configurations....anyone please help me how to do this?
Also i don't want to keep all these .csv files...i just want to keep last day file of everymonth and last donloaded file...How to approac this
Thanks in advance,
jyo
August 11th, 2011 3:11pm
This is now you consume a package variable in a Script Task:
Dim MyPath As String
If Dts.Variables.Contains("MyPath") = True Then
Mypath = _
CType(Dts.Variables("MyPath").Value, String)
End If
Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2011 3:15pm
Here are some examples of using variables in a Script Task:
http://microsoft-ssis.blogspot.com/2010/12/how-to-use-variables-in-script-task.html
Also see this example:http://microsoft-ssis.blogspot.com/2011/05/download-source-file-from-website-with.html
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com
August 11th, 2011 4:21pm
you can create a variable of type string in package scope,
then in script task you can use it,
you should select this variable in ReadOnlyVaraibles property of script task in general tab, this will allow script to use this variable to read data.
if you want to write a value in this variable also, you should set this variable in the ReadWriteVariables property.
then in script task you can use this signature to use it:
myConnection.DownloadFile(Dts.Variables["User::MyVariable"].Value.ToString(),
true);
and about your second question on latest file, I didn't get what you mean, It completely don't make sense , could explain more ?
http://www.rad.pasfu.com
My Submitted sessions at sqlbits.com
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2011 4:41pm
Also i don't want to keep all these .csv files...i just want to keep last day file of everymonth and last donloaded file...How to approac this
You could do something with the actual
creationdate of the files...Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com
August 11th, 2011 4:48pm