dbTalk Databases Forums  

Importing Empty FIle

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


Discuss Importing Empty FIle in the microsoft.public.sqlserver.dts forum.



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

Default Importing Empty FIle - 10-25-2006 , 03:14 AM






Hi,

I wonder if there is a work around for the following problem, I have a DTS
pack that imports a number of uploaded files as well as files that show
errors that we have had in the files that we have uploaded. The DTS works
fine when there are errors listed in the Error file but wont work when the
file is empty, you get the error

"Error creating datafile mapping: The volume for a file has been externally
altered so that the opened file is no longer valis."

I know that really this makes sense, but I could do with the DTS not failing
at this point, any ideas, what I would like if for it to do is complete the
DTS and just have an empty table where the files should be imported into.

Thanks PD

Reply With Quote
  #2  
Old   
Norman Kelm
 
Posts: n/a

Default Re: Importing Empty FIle - 10-25-2006 , 05:57 AM






Hi Phil,

Perhaps you could write an ActiveX script task that opens the error file
and counts the number of rows. Then have success and failure constraints
that point to the correct action. Success run the transform.

Norman

get DTS Package Search at http://www.gerasus.com/

Phil wrote:
Quote:
Hi,

I wonder if there is a work around for the following problem, I have a DTS
pack that imports a number of uploaded files as well as files that show
errors that we have had in the files that we have uploaded. The DTS works
fine when there are errors listed in the Error file but wont work when the
file is empty, you get the error

"Error creating datafile mapping: The volume for a file has been externally
altered so that the opened file is no longer valis."

I know that really this makes sense, but I could do with the DTS not failing
at this point, any ideas, what I would like if for it to do is complete the
DTS and just have an empty table where the files should be imported into.

Thanks PD

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

Default Re: Importing Empty FIle - 10-25-2006 , 07:54 AM



Norman is right, I had to do something similar with zip files, though I
was checking that there were more than 4 rows by size.

You can use the File System Object to point to the file, then check the
size.
Something like this

filename="c:\test\test.txt"

Set fso = CreateObject("Scripting.FileSystemObject")

set mainfile=fso.GetFile(filename)

IF mainfile.Size > 50 Then -- this is in bytes
-- Do something
ELSE
-- Do something else
END IF


regards

Weelin


On Oct 25, 11:57 am, Norman Kelm <nor... (AT) no-spam (DOT) gerasus.com> wrote:
Quote:
Hi Phil,

Perhaps you could write an ActiveX script task that opens the error file
and counts the number of rows. Then have success and failure constraints
that point to the correct action. Success run the transform.

Norman

get DTS Package Search athttp://www.gerasus.com/



Phil wrote:
Hi,

I wonder if there is a work around for the following problem, I have a DTS
pack that imports a number of uploaded files as well as files that show
errors that we have had in the files that we have uploaded. The DTS works
fine when there are errors listed in the Error file but wont work when the
file is empty, you get the error

"Error creating datafile mapping: The volume for a file has been externally
altered so that the opened file is no longer valis."

I know that really this makes sense, but I could do with the DTS not failing
at this point, any ideas, what I would like if for it to do is complete the
DTS and just have an empty table where the files should be imported into.

Thanks PD- Hide quoted text -- Show quoted text -


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.