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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 updating filename using a dts package

Author  Topic 

chowchow123
Starting Member

3 Posts

Posted - 2009-02-10 : 05:52:39
Hi

In a dts package I have a server connecting to a text file - it transfers data into the text file. A datetime stamp is added using an activex script afterwards as below but the problem is the datetime stamp is not only updated when the package is run - what could be the problem?


Function Main()
Dim oConn, sFilename

' Filename format - Filename_yymmddhhmmss.txt

sFilename = "c:\filename_" & Right(Year(Now()), 2)
If Month(Now()) < 10 Then sFilename = sFilename & "0" & _
Month(Now()) Else sFilename = sFilename & Month(Now())
If Day(Now()) < 10 Then sFilename = sFilename & _
"0" & Day(Now()) Else sFilename = sFilename & Day(Now())
If Hour(Now()) < 10 Then sFilename = sFilename & "0" & _
Hour(Now()) Else sFilename = sFilename & Hour(Now())
If Minute(Now()) < 10 Then sFilename = sFilename & "0" & _
Minute(Now()) Else sFilename = sFilename & Minute(Now())
If Second(Now()) < 10 Then sFilename = sFilename & "0" & _
Second(Now()) Else sFilename = sFilename & Second(Now())
sFilename = DTSGlobalVariables("FilePath").Value & _
sFilename & ".txt"

Set oConn = DTSGlobalVariables.Parent.Connections("Filename")
oConn.DataSource = sFilename

Set oConn = Nothing

Main = DTSTaskExecResult_Success
End Function

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-10 : 06:19:48
i think what you're looking is something like this

http://neonlabs.structum.net/blog/?p=235
Go to Top of Page

chowchow123
Starting Member

3 Posts

Posted - 2009-02-10 : 11:13:32
will that work for sql 2000 - that example seems more relevant for SSIS in sql2005
Go to Top of Page
   

- Advertisement -