Technology Musings
Undoubtedly, you’re reading this because you’ve discovered that SQL Server Integration Services (as of SSIS 2008) will not allow you to set the password of an FTP connection through expressions. Fortunately, there is an easy workaround, that requires a simple Script Task. While not as simple as native expression support, it’s darn close. I’ve included C# code, but you may need to adapt to VB.Net if that’s your preferred flavor.
1 2 3 4 5 6 7 8 | public void Main() { ConnectionManager FTPConn; FTPConn = Dts.Connections["FTPServer"]; FTPConn.Properties["ServerPassword"].SetValue(FTPConn, Dts.Variables["FTPPassword"].Value); Dts.TaskResult = (int)ScriptResults.Success; } |
A couple notes:
That’s it. Make sure you’ve got this task being executed before your actual FTP task and everything should work fine. Cheers!