dbTalk Databases Forums  

Bypass step when source file empty

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


Discuss Bypass step when source file empty in the microsoft.public.sqlserver.dts forum.



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

Default Bypass step when source file empty - 05-17-2004 , 10:01 AM






Hi group,

I have a DTS package where one of the step is to load a flat file into a sql
table. The source file can sometimes be empty. How can I avoid an error
state from this step FOR ONLY THIS (other failure should still be observed)
and continue executing the following steps that have work flow dependency on
this step, when this file comes in empty?

Advise/sample code greatly appreciated.

Quentin



Reply With Quote
  #2  
Old   
Isak Dinesen
 
Posts: n/a

Default Re: Bypass step when source file empty - 05-17-2004 , 12:45 PM






DTS doesn't like 0-byte files, so the simplest way to do this I've found
work around this is to initilize the file with some bytes in the first row.
A good place to start would be outputting a header row, but if you don't
have time to update your legacy systems to do that, there are other options.
For eample, if you are using csv format, put an empty crlf on the first line
(or ,,,,), then define the connection to ignore the first line. If you are
using fixed format, you'll need to put the exact number of spaces on the
first line as is used on all subsequent lines.

HTH


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

Quote:
Hello Quentin,

You could achieve this via an active x script. Please read more about
"FileSystemObject"s.

hth,
K

----- Quentin Ran wrote: -----

Hi group,

I have a DTS package where one of the step is to load a flat file
into a sql
table. The source file can sometimes be empty. How can I avoid an
error
state from this step FOR ONLY THIS (other failure should still be
observed)
and continue executing the following steps that have work flow
dependency on
this step, when this file comes in empty?

Advise/sample code greatly appreciated.

Quentin






Reply With Quote
  #3  
Old   
Quentin Ran
 
Posts: n/a

Default Re: Bypass step when source file empty - 05-17-2004 , 04:15 PM



Thanks for the response. However, I could not find a suitable object for
this -- maybe due to my unfamiliarity with the objects. Someone can point
me farther? Thanks.

Quentin

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

Quote:
Hello Quentin,

You could achieve this via an active x script. Please read more about
"FileSystemObject"s.

hth,
K

----- Quentin Ran wrote: -----

Hi group,

I have a DTS package where one of the step is to load a flat file
into a sql
table. The source file can sometimes be empty. How can I avoid an
error
state from this step FOR ONLY THIS (other failure should still be
observed)
and continue executing the following steps that have work flow
dependency on
this step, when this file comes in empty?

Advise/sample code greatly appreciated.

Quentin






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

Default Re: Bypass step when source file empty - 05-18-2004 , 04:34 PM



In message <uitQD$BPEHA.2920 (AT) tk2msftngp13 (DOT) phx.gbl>, Quentin Ran
<ab (AT) who (DOT) com> writes
Quote:
Hi group,

I have a DTS package where one of the step is to load a flat file into a sql
table. The source file can sometimes be empty. How can I avoid an error
state from this step FOR ONLY THIS (other failure should still be observed)
and continue executing the following steps that have work flow dependency on
this step, when this file comes in empty?

Advise/sample code greatly appreciated.

Quentin


Try the following articles, but instead of checking if the file exists,
you can check the file size, through the FileSystemObject as per one of
the other posts.

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

Skip the execution of an individual Task
(http://www.sqldts.com/default.aspx?214)
--
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
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.