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.
Author |
Topic |
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2013-01-16 : 17:30:13
|
Hello there.does anyone know of a simple or common script for FTP transfer.I would like to look for a file with the same file name but looking for the oldest newest version.RegardsRob |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-01-17 : 04:14:17
|
Can you use the FTP task in SSIS?There is a Powershell FTP script here: http://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb I have not used it myself, but seems to be actively maintained.I have not used either of the above. Couple of years ago when I was trying to do something similar, I really did not find anything that met my needs. Ideally I would like the FTP script to accept regular expressions for file names and other parameters. I ended up writing one for myself - not robust enough to distribute, otherwise I would have. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2013-01-17 : 05:57:36
|
ok thank you.This will need to run once a day, picking up a certain file name, for example. todaysfile17012013.txtso i will need to search on the todaysfile part, then code in the date part. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2013-01-18 : 07:59:38
|
Hello there. i have got as far as the script task in the walk through above.when i open the edit script screen via the script task i get the following./* Microsoft SQL Server Integration Services Script Task Write scripts using Microsoft Visual C# 2008. The ScriptMain is the entry point class of the script.*/using System;using System.Data;using Microsoft.SqlServer.Dts.Runtime;using System.Windows.Forms;namespace ST_6f7a7d21d7b14a93ad84b9635bd9dec2.csproj{ [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")] public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase { #region VSTA generated code enum ScriptResults { Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success, Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure }; #endregion /* The execution engine calls this method when the task executes. To access the object model, use the Dts property. Connections, variables, events, and logging features are available as members of the Dts property as shown in the following examples. To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value; To post a log entry, call Dts.Log("This is my log text", 999, null); To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true); To use the connections collection use something like the following: ConnectionManager cm = Dts.Connections.Add("OLEDB"); cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;"; Before returning from this method, set the value of Dts.TaskResult to indicate success or failure. To open Help, press F1. */ public void Main() { // TODO: Add your code here Dts.TaskResult = (int)ScriptResults.Success; } }}the walk through suggests public sub main()''add your code here'dts.taskresult = scriptResults.successDim currentday as sringcurrentday = now().toString("yyymmdd")Dts.Variables("Currentdayfile").Value = IIf(InStr(Dts.Variables("Filename").value, currentDay) > 0, true, false)where would i insert the script. Also the walk through does not explain how to set the FTP task up |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|