dbTalk Databases Forums  

Communicating between SQL & VBScript

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


Discuss Communicating between SQL & VBScript in the microsoft.public.sqlserver.dts forum.



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

Default Communicating between SQL & VBScript - 07-14-2004 , 04:20 PM






Hey all,

Sorry to swamp the newsgroup buuut... In the ActiveX script area of an
Execute SQL Task is where my problem lies. I am having difficulty getting
SQL to talk to VBScript...

sqlstatement = "IF (SELECT COUNT(*) FROM "&
DTSGlobalVariables("Processed_Table").Value &" WHERE lastname LIKE '%,%') >
0"

I'm trying to get the line above (which simply checks if the lastname field
has a comma in it) to do the following: If TRUE (ergo, there are any commas)
then stop processing and send an email. If FALSE, then continue on following
the "success" arrows to completion.

Make sense? Of course I can execute the SQL statement through VBScript fine,
I just can't figure out my next step... Any help is greatly appreciated!
THANKS!!!

I will be a DTS pro yet!



Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: Communicating between SQL & VBScript - 07-15-2004 , 08:47 AM






Sayonara,

If I understood correctly you would like to have two branches of execution
from the decision point and execute one of them depending on the result. In
this case I'd recommend those two branches be created as separate(detached)
with the first steps disabled. The decision step would set new two package
variables to -1 to leave the branch disabled or to 0 to enable it. You'd
need to add Dynamic Properties step to the decision step to set Disabled
property of first steps of the branches to the variables. The decision step
can be an Execute SQL Task (or ActiveX) with the following SQL and the
variables going as the output parameters:

SELECT DisableEmail = SIGN(COUNT(*)) - 1
,DisableProcessing = -SIGN(COUNT(*))
FROM Processed_Table
WHERE lastname LIKE '%,%'

Ilya

"Sayonara" <me (AT) msn (DOT) com> wrote

Quote:
Hey all,

Sorry to swamp the newsgroup buuut... In the ActiveX script area of an
Execute SQL Task is where my problem lies. I am having difficulty getting
SQL to talk to VBScript...

sqlstatement = "IF (SELECT COUNT(*) FROM "&
DTSGlobalVariables("Processed_Table").Value &" WHERE lastname LIKE '%,%')

0"

I'm trying to get the line above (which simply checks if the lastname
field
has a comma in it) to do the following: If TRUE (ergo, there are any
commas)
then stop processing and send an email. If FALSE, then continue on
following
the "success" arrows to completion.

Make sense? Of course I can execute the SQL statement through VBScript
fine,
I just can't figure out my next step... Any help is greatly appreciated!
THANKS!!!

I will be a DTS pro yet!





Reply With Quote
  #3  
Old   
Sayonara
 
Posts: n/a

Default Re: Communicating between SQL & VBScript - 07-15-2004 , 06:35 PM



Ilya,
What do "DisableEmail" and "DisableProcessing" reference below? I tried to
set them as global variables in an Execute DTS task, but am failing...

Thanks!

"Ilya Margolin" <ilya (AT) unapen (DOT) com> wrote

Quote:
Sayonara,

If I understood correctly you would like to have two branches of execution
from the decision point and execute one of them depending on the result.
In
this case I'd recommend those two branches be created as
separate(detached)
with the first steps disabled. The decision step would set new two package
variables to -1 to leave the branch disabled or to 0 to enable it. You'd
need to add Dynamic Properties step to the decision step to set Disabled
property of first steps of the branches to the variables. The decision
step
can be an Execute SQL Task (or ActiveX) with the following SQL and the
variables going as the output parameters:

SELECT DisableEmail = SIGN(COUNT(*)) - 1
,DisableProcessing = -SIGN(COUNT(*))
FROM Processed_Table
WHERE lastname LIKE '%,%'

Ilya

"Sayonara" <me (AT) msn (DOT) com> wrote in message
news:2llmekFedbcpU1 (AT) uni-berlin (DOT) de...
Hey all,

Sorry to swamp the newsgroup buuut... In the ActiveX script area of an
Execute SQL Task is where my problem lies. I am having difficulty
getting
SQL to talk to VBScript...

sqlstatement = "IF (SELECT COUNT(*) FROM "&
DTSGlobalVariables("Processed_Table").Value &" WHERE lastname LIKE
'%,%')

0"

I'm trying to get the line above (which simply checks if the lastname
field
has a comma in it) to do the following: If TRUE (ergo, there are any
commas)
then stop processing and send an email. If FALSE, then continue on
following
the "success" arrows to completion.

Make sense? Of course I can execute the SQL statement through VBScript
fine,
I just can't figure out my next step... Any help is greatly appreciated!
THANKS!!!



Reply With Quote
  #4  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: Communicating between SQL & VBScript - 07-16-2004 , 07:58 AM



You have to add them first to Global Variables in the package Properties.

"Sayonara" <me (AT) msn (DOT) com> wrote

Quote:
Ilya,
What do "DisableEmail" and "DisableProcessing" reference below? I tried to
set them as global variables in an Execute DTS task, but am failing...

Thanks!

"Ilya Margolin" <ilya (AT) unapen (DOT) com> wrote in message
news:OFCUGInaEHA.3072 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Sayonara,

If I understood correctly you would like to have two branches of
execution
from the decision point and execute one of them depending on the result.
In
this case I'd recommend those two branches be created as
separate(detached)
with the first steps disabled. The decision step would set new two
package
variables to -1 to leave the branch disabled or to 0 to enable it. You'd
need to add Dynamic Properties step to the decision step to set Disabled
property of first steps of the branches to the variables. The decision
step
can be an Execute SQL Task (or ActiveX) with the following SQL and the
variables going as the output parameters:

SELECT DisableEmail = SIGN(COUNT(*)) - 1
,DisableProcessing = -SIGN(COUNT(*))
FROM Processed_Table
WHERE lastname LIKE '%,%'

Ilya

"Sayonara" <me (AT) msn (DOT) com> wrote in message
news:2llmekFedbcpU1 (AT) uni-berlin (DOT) de...
Hey all,

Sorry to swamp the newsgroup buuut... In the ActiveX script area of an
Execute SQL Task is where my problem lies. I am having difficulty
getting
SQL to talk to VBScript...

sqlstatement = "IF (SELECT COUNT(*) FROM "&
DTSGlobalVariables("Processed_Table").Value &" WHERE lastname LIKE
'%,%')

0"

I'm trying to get the line above (which simply checks if the lastname
field
has a comma in it) to do the following: If TRUE (ergo, there are any
commas)
then stop processing and send an email. If FALSE, then continue on
following
the "success" arrows to completion.

Make sense? Of course I can execute the SQL statement through VBScript
fine,
I just can't figure out my next step... Any help is greatly
appreciated!
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.