Alex,
Yea, I am used to c-style, java style if statements (my first language was java). In fact, the only other place where I have seen if statements with that syntax is using PL/SQL. Thanks for the help.
I am still getting an error tho! This is getting to be quite frustrating. Here is my layout, and hopefully you can help me pinpoint the problem, because I am at a loss. Everything seems to be in line.
My DTS package starts off at "check for records" SQL task. Here, I use the query:
Code:
select count(emailaddress) as CNT from
view_lead_display2
where (DateDiff (day,LeadInsertDate ,getdate() )=1)
and unsub='1' and leadid not in (select distinct leadid from dbo.Leads_Reassigned)
Then, I click Parameters->Output Parameters, with Output Parameter Type being Row Value, and Parameter Mapping with Parameters CNT and Output Global Variables cnt. On Success, I go to "should continue" ActiveX Script. In this script, here is the code:
Code:
Function Main()
If DTSGlobalVariables("CNT").Value < 1 Then
Main = DTSTaskExecResult_Failure
Else
Main = DTSTaskExecResult_Success
End If
End Function
From here, if On Failure, go to "do nothing" ActiveX Script which does nothing. If On Success, go to "change file name" ActiveX Script. Here is the code:
Code:
Function Main()
mydate =now()
sFilename = "C:\Documents and Settings\Administrator.REDOAKGROUP\My Documents\Yamaha\red_oak_optout_emails_" & Right(Year(mydate), 4)
If Month(mydate) < 10 Then sFilename = sFilename & "0" & _
Month(mydate) Else sFilename = sFilename & Month(mydate)
If Day(mydate) < 10 Then sFilename = sFilename & _
"0" & (Day(Mydate) - 1) Else If Day(Mydate) = 10 Then sFilename = sFilename & _
"0" & (Day(Mydate) - 1) Else sFilename = sFilename & (Day(mydate) - 1)
sFilename = DTSGlobalVariables("LogFilePath").Value & _
sFilename & ".txt"
Set oConn = DTSGlobalVariables.Parent.Connections("Connection 2")
oConn.DataSource = sFilename
Set oConn = Nothing
Main = DTSTaskExecResult_Success
End Function
This script appends the current date minus 1 to the end of the output file. On Success, this goes to "Connection 1" DB Provider. Then from "Connection 1", I have a Transform Data Task, with the sql code:
Code:
select emailaddress as EMAIL from
view_lead_display2
where (DateDiff (day,LeadInsertDate ,getdate() )=1)
and unsub='1' and leadid not in (select distinct leadid from dbo.Leads_Reassigned)
This outputs to "Connection 2", a text file destination. Now, I know for a fact that change file name, Connection 1, and Connection 2 work correctly. The error I get is when I try to run "should continue". All I get is this crypt message: "The task reported failure on execution". As I said before, I am completely new to DTS and everything seems to fine to me, as far as workflow goes. Do you see anything that I am doing wrong?