dbTalk Databases Forums  

T-SQL strong. VBScript weak. Help?

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


Discuss T-SQL strong. VBScript weak. Help? in the microsoft.public.sqlserver.dts forum.



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

Default T-SQL strong. VBScript weak. Help? - 01-25-2006 , 01:35 PM






I need an activeX script that will:

Query a table in my database:

Select FailReason from ErrorLog where DateOfFileCopy = getDate()

I want to store the result in a variable called flds.

then:

If Flds = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If


Help?????
I can't fill in the missing pieces (i.e, the get the data part)

Thanks

Reply With Quote
  #2  
Old   
JuiceN
 
Posts: n/a

Default RE: T-SQL strong. VBScript weak. Help? - 01-25-2006 , 02:16 PM






update:


This is as far as i have gotten with this:

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Option Explicit

Public Function Main()



Dim db as Database, myRecordset as Recordset, mySQLCmdText as string


mySQLCmdText = "Select FailReason from [ErrorLog] where [DateOfFileCopy] =
getDate()"
set myRecordset = db.OpenRecordSet(mySQLCmdText)

If myRecordset![FailReason] = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If
Main = DTSTaskExecResult_Success


End Function

================================================

"JuiceN" wrote:

Quote:
I need an activeX script that will:

Query a table in my database:

Select FailReason from ErrorLog where DateOfFileCopy = getDate()

I want to store the result in a variable called flds.

then:

If Flds = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If


Help?????
I can't fill in the missing pieces (i.e, the get the data part)

Thanks

Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default RE: T-SQL strong. VBScript weak. Help? - 01-25-2006 , 03:03 PM



Hello JuiceN,


There is a far simpler way than having to do some VBcript coding.

Use an ExecuteSQL task to assign the value from the statement to a Global
Variable.

Your statement would stay the same.

The statement you are issuing in fct is very precise for a log record you
are asking for the row where DataOfFileCopy = Getdate(). This is very precise.

Allan




Quote:
update:

This is as far as i have gotten with this:

'************************************************* ********************
*
' Visual Basic ActiveX Script
'************************************************* ********************
***
Option Explicit
Public Function Main()

Dim db as Database, myRecordset as Recordset, mySQLCmdText as string

mySQLCmdText = "Select FailReason from [ErrorLog] where
[DateOfFileCopy] =
getDate()"
set myRecordset = db.OpenRecordSet(mySQLCmdText)
If myRecordset![FailReason] = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If
Main = DTSTaskExecResult_Success
End Function

================================================

"JuiceN" wrote:

I need an activeX script that will:

Query a table in my database:

Select FailReason from ErrorLog where DateOfFileCopy = getDate()

I want to store the result in a variable called flds.

then:

If Flds = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If
Help?????
I can't fill in the missing pieces (i.e, the get the data part)
Thanks




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.