dbTalk Databases Forums  

DTS Active X scripts

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Active X scripts in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jemacc
 
Posts: n/a

Default DTS Active X scripts - 05-10-2004 , 09:31 PM






I Have a dts package that work sometimes when executed

Here is what the package looks lik

SQL Server --> (my SQL server and database
I create a text file[ destination
then I use the transformation task to connect the database to the flat fil

I run this query to extract the information I need for that dat
select trans_day,trans_info, trans_datetime fro
webtrans
where trans_day = cast(datepart(yyyy, getdate()) as varchar) + right('0' + cast(datepart(month, getdate()) as varchar), 2) + right('0' + cast(datepart(day, getdate()) as varchar), 2

I add the activceX script task (WWW.SQLDTS.com
'************************************************* ********************
' Visual Basic ActiveX Scrip
'************************************************* **********************
Option Explici
Function Main(
Dim oConn, sFilenam
' Filename format - webcredits_yyyymmdd.tx
sFilename = "WebCredits" &"_"& Right(Year(Now()), 4)+
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()
sFilename = DTSGlobalVariables("LogFilePath").Value & _
sFilename & ".txt

Set oConn = DTSGlobalVariables.Parent.Connections("Text File (Destination)"
oConn.DataSource = sFilenam
Set oConn = Nothin
Main = DTSTaskExecResult_Succes
End Functio

I connect the activex Script task with an "On success" workflow tas

What happens with this job is that on the file text destination the file gets created like this webcredits_20040510.tx
so the next time is run the global variable "logfilepath" changes that connection to the file file path I specific, so it ends up looking like this: \\servername\E$\webcredits\webcredits_20040510.txt (which is the filename and the current date

when I runb the job the next day, it keeps that same value "webcredits_20040510.txt " when it is to change with the value for the current date and file name "\\servername\E$\webcredits\webcredits_20040511.tx t
I have manually run it several times for it to change to the logfilepath variable

This line from the activex Script was original written like this "Set oConn = DTSGlobalVariables.Parent.Connections("Text File (source)")" wihtout the outside quote

Can anyone offer some insight on how I can correct this problem



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.