March 1, 2007 at 1:51 pm
Here is my issue...I need to add a step to an existing DTS package that check for data from a query. If data returns, I need to stop processing the DTS package; otherwise, continue. I'm sure this can be done with ActiveX, I just can't find an ActiveX script that check for query results. I'd appreciate any help you can give me. Thanks.
Mike
March 1, 2007 at 5:56 pm
Try this in ActiveX Script Task:
Function Main()
Dim cn
Dim rs
Dim Flag
Set cn = CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")
cn.ActiveConnection = "Provider=sqloledb;Data Source=Server;Initial Catalog=database;User Id=login;Password=password;"
cn.CommandType = 1 'adCmdText
cn.ActiveConnection.CursorLocation = 3 'adUseClient
cn.CommandTimeout = 60 'set to 1 min
cn.CommandText = "Select * From
"
Set rs = cn.Execute()
If rs.RecordCount > 0 Then
Flag = "F"
Else
Flag = "S"
End If
Set rs = Nothing
Set cn = Nothing
'msgbox "Result=" & Flag
If Flag = "S" Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If
End Function
March 29, 2007 at 12:37 pm
Terry,
Sorry for the delay. Thanks, this worked perfectly!
Mike
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply