dbTalk Databases Forums  

No error before loading a 0 byte file...

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


Discuss No error before loading a 0 byte file... in the microsoft.public.sqlserver.dts forum.



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

Default No error before loading a 0 byte file... - 10-17-2005 , 01:51 PM






Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails and
doens't load...My question: Is there any code that I can use to maybe send an
email on a 0 byte file, but not page me? I do want to know of load failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren

Reply With Quote
  #2  
Old   
Rodney Mullins
 
Posts: n/a

Default Re: No error before loading a 0 byte file... - 10-17-2005 , 11:58 PM






Warren,

You should be able to use the FileSystemObject to determine the size of
your file.
' Copy File
Option Explicit
Function Main()

Dim oFSO
Dim oFile
Dim sSourceFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

sSourceFile = 'c:\test.txt'
Set oFile = oFSO.GetFile(sSourceFile)

If oFile.Size > 0 Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If

' Clean Up
Set oFile = Nothing
Set oFSO = NothingEnd FunctionRodney Mullinsrodney_mullins (AT) msn (DOT) com"Warren"
<Warren (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is
loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails
and
doens't load...My question: Is there any code that I can use to maybe send
an
email on a 0 byte file, but not page me? I do want to know of load
failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren



Reply With Quote
  #3  
Old   
Rodney Mullins
 
Posts: n/a

Default Re: No error before loading a 0 byte file... - 10-18-2005 , 12:02 AM



also, the sample code that I provided can be found at:
www.sqldts.com

"Warren" <Warren (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is
loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails
and
doens't load...My question: Is there any code that I can use to maybe send
an
email on a 0 byte file, but not page me? I do want to know of load
failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren



Reply With Quote
  #4  
Old   
Warren
 
Posts: n/a

Default Re: No error before loading a 0 byte file... - 10-18-2005 , 04:44 PM



Thanks Rodney,

I will try that...

Warren

"Rodney Mullins" wrote:

Quote:
also, the sample code that I provided can be found at:
www.sqldts.com

"Warren" <Warren (AT) discussions (DOT) microsoft.com> wrote in message
news:13414CF0-A5BB-4C5A-9E15-238473AD41D5 (AT) microsoft (DOT) com...
Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is
loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails
and
doens't load...My question: Is there any code that I can use to maybe send
an
email on a 0 byte file, but not page me? I do want to know of load
failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren




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

Default Re: No error before loading a 0 byte file... - 10-19-2005 , 02:31 PM



Dear Rodney,

The code you sent does work but doesn't do exactly what I want. The part
that fails if the byte size is less than zero fails the package also which
sends a page. I'm trying to get the script to say , OK > than zero, sucess,
now load the file...If < than zero, do nothing, don't fail the package or go
to the next step (which is load the file).

Thanks,

Warren

"Rodney Mullins" wrote:

Quote:
also, the sample code that I provided can be found at:
www.sqldts.com

"Warren" <Warren (AT) discussions (DOT) microsoft.com> wrote in message
news:13414CF0-A5BB-4C5A-9E15-238473AD41D5 (AT) microsoft (DOT) com...
Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is
loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails
and
doens't load...My question: Is there any code that I can use to maybe send
an
email on a 0 byte file, but not page me? I do want to know of load
failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren




Reply With Quote
  #6  
Old   
Warren
 
Posts: n/a

Default Re: No error before loading a 0 byte file... - 10-19-2005 , 04:47 PM



Dear Rodney,

I got it figured out by using the DTS site you provided ...Thanks!

Warren

"Warren" wrote:

Quote:
Dear Rodney,

The code you sent does work but doesn't do exactly what I want. The part
that fails if the byte size is less than zero fails the package also which
sends a page. I'm trying to get the script to say , OK > than zero, sucess,
now load the file...If < than zero, do nothing, don't fail the package or go
to the next step (which is load the file).

Thanks,

Warren

"Rodney Mullins" wrote:

also, the sample code that I provided can be found at:
www.sqldts.com

"Warren" <Warren (AT) discussions (DOT) microsoft.com> wrote in message
news:13414CF0-A5BB-4C5A-9E15-238473AD41D5 (AT) microsoft (DOT) com...
Hi All,

I have a DTS package that 1) Goes to an FTP site, 2) Copied a file to a
directory, 3) Loads the file into a sql database. 4) renames the file and
saves it to a different directory....

Background : Each time the DTS package copies a 0 byte file, the load
fails..OK no problem. But I have failures setup to page me...A file is
loaded
every 2hours....If it's 0 byte file, that's OK, because the package fails
and
doens't load...My question: Is there any code that I can use to maybe send
an
email on a 0 byte file, but not page me? I do want to know of load
failures,
but to me the 0 byte file is not a failure???

Thanks,

Warren




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.