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 |
pazzy11
Posting Yak Master
145 Posts |
Posted - 2008-02-06 : 05:06:05
|
Hi I have this Active X code from a DTS [CODE]intDay = Day(DTSGlobalVariables("gStartDate").Value)) intMonth = Month(DTSGlobalVariables("gStartDate").Value)) intYear = Year(DTSGlobalVariables("gStartDate").Value)) ' Add starting zero if needed If (intDay < 10) Then intDay = "0" & intDay If (intMonth) < 10 Then intMonth = "0" & intMonth ' Build date string strDDMMYYYY = intDay & intMonth & intYear String strDirectory = "E:\Shared\backoffice_dts_extraction\archive" & "\" & strDDMMYYYY & "\Suffix_CONV_FIX\" objFSO = CreateObject("Scripting.FileSystemObject") bDummy = MakePath(objFSO, strDirectory) objFSO.CopyFile(DTSSource("fulldoc"), strDirectory & DTSSource("DOCUMENT"), True) Main = DTSTransformStat_OK[/CODE]It's giving me a lot of errors when i try and use this in an SSIS script component namely "variable name not declared" ..anyone know the proper syntax for SSIS scripts ? |
|
Qualis
Posting Yak Master
145 Posts |
Posted - 2008-02-06 : 15:27:06
|
It would be better to use a Script Task. Make sure you have created (and filled) your variables (gStartDate, fulldoc, DOCUMENT). In the Script property page on the Script Task, in the ReadOnlyVariables box, put: gStartDate, fulldoc, DOCUMENT. In the code window, the following should reproduce the intended behavior properly: FileSystem.FileCopy( _ Dts.Variables("fulldoc").Value.ToString(), _ "E:\Shared\backoffice_dts_extraction\archive\" & _ Format(CDate(Dts.Variables("gStartDate").Value), "ddMMyyyy") & _ "\Suffix_CONV_FIX\" & _ Dts.Variables("DOCUMENT").Value.ToString()) Dts.TaskResult = Dts.Results.Success |
 |
|
|
|
|