Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How to read a filename into a variable

Author  Topic 

igorblackbelt
Constraint Violating Yak Guru

407 Posts

Posted - 2008-01-14 : 09:52:25
I'm trying to read the filename from a file that I'm downloading by FTP (FTP Component) into a string variable so I can later use it for another part of the process, how can I do this?

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2008-01-14 : 16:34:58
activex / fso?
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2008-01-16 : 08:02:40
Possible solution -

1) Create Variable name: strFileName

2) Foreach Loop: Foreach File Enumerator

Variable Mappings:
Variable = User::strFileName, Index=0

3) Test...
Script Task:
Script ReadOnlyVariables = strFileName
...
Public Sub Main()
MsgBox("Filename: " & Dts.Variables("strFileName").Value.ToString)
Dts.TaskResult = Dts.Results.Success
End Sub

If successful you can call variable from anywhere (make sure variable is at the parent level)

Good luck!
Go to Top of Page
   

- Advertisement -