dbTalk Databases Forums  

Exit the package if the file byte size is zero

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


Discuss Exit the package if the file byte size is zero in the microsoft.public.sqlserver.dts forum.



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

Default Exit the package if the file byte size is zero - 08-17-2004 , 02:52 PM






Hi!

So, if the file byte size is zero (first task), I need the entire
package to be exit (dont do anything else). I am using this ActiveX
script:

Function Main()

Dim fso, filepath, filesize

Set fso = CreateObject("Scripting.FileSystemObject")

Set filepath = fso.GetFile("c:\foobar\blah.txt")

filesize = filepath.Size
MsgBox(filesize)

If filesize = 0 Then

'QUIT
Else
' Go to the next task which is Execute SQL task
Main = DTSTaskExecResult_Success

End If
End Function

This script is giving the correct file size but I dont know how to exit
from the entire package (or skip all other tasks)? Can anyone help?

Thanks for your help.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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

Default RE: Exit the package if the file byte size is zero - 08-17-2004 , 03:29 PM






Main = DTSTaskExecResult_Failure

"F HS" wrote:

Quote:
Hi!

So, if the file byte size is zero (first task), I need the entire
package to be exit (dont do anything else). I am using this ActiveX
script:

Function Main()

Dim fso, filepath, filesize

Set fso = CreateObject("Scripting.FileSystemObject")

Set filepath = fso.GetFile("c:\foobar\blah.txt")

filesize = filepath.Size
MsgBox(filesize)

If filesize = 0 Then

'QUIT
Else
' Go to the next task which is Execute SQL task
Main = DTSTaskExecResult_Success

End If
End Function

This script is giving the correct file size but I dont know how to exit
from the entire package (or skip all other tasks)? Can anyone help?

Thanks for your help.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #3  
Old   
F HS
 
Posts: n/a

Default RE: Exit the package if the file byte size is zero - 08-18-2004 , 10:12 AM



MJ,

It works but at the same time it is giving me an error message saying
"The task reported failure on execution". Any idea how to handle this?
In my DTS pcakage, after this ActiveX script task, I have set up two
"Execute SQL" tasks. One is with the success work flow (file size = 0,
do a dummy query) and one is with the failure work flow (do actutal
query whihc is exec stored proc).

Thanks,




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Exit the package if the file byte size is zero - 08-18-2004 , 03:09 PM



In message <#o$zUXThEHA.3024 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, F HS
<far_far (AT) hotmail (DOT) com> writes
Quote:
MJ,

It works but at the same time it is giving me an error message saying
"The task reported failure on execution". Any idea how to handle this?
In my DTS pcakage, after this ActiveX script task, I have set up two
"Execute SQL" tasks. One is with the success work flow (file size = 0,
do a dummy query) and one is with the failure work flow (do actutal
query whihc is exec stored proc).

Thanks,

Use a workflow script instead, e.g.

How can I check if a file exists?
(http://www.sqldts.com/default.aspx?211)


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #5  
Old   
MJ
 
Posts: n/a

Default RE: Exit the package if the file byte size is zero - 08-18-2004 , 03:25 PM



If you want the package to exit gracefully you have to implement workflow.

If success then
execute tasks
else
do not execute task
end if



"F HS" wrote:

Quote:
MJ,

It works but at the same time it is giving me an error message saying
"The task reported failure on execution". Any idea how to handle this?
In my DTS pcakage, after this ActiveX script task, I have set up two
"Execute SQL" tasks. One is with the success work flow (file size = 0,
do a dummy query) and one is with the failure work flow (do actutal
query whihc is exec stored proc).

Thanks,




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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.