Env: SQL Server 2000 on in WIN NT 5.x
Job: import mutiple flat files into several tables daily.
Catch: one or two of the several flat files might be empty.
First thought/test:
Use [first row as fields] option for the import process.
Problem, DTS can't complete (as a package).
As an alternative, I could probably detect if a file is empty then
decide what to do with it, with VB activeX, it might be feasible,
question, VB has a command for "FileExist", how about "FileLen" or the
like for determining the length of a file?
TIA. 6 2833
Hi
See http://www.sqldts.com/default.aspx?292 and http://www.sqldts.com/default.aspx?246
John
"NickName" <da****@rock.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Env: SQL Server 2000 on in WIN NT 5.x Job: import mutiple flat files into several tables daily. Catch: one or two of the several flat files might be empty.
First thought/test: Use [first row as fields] option for the import process. Problem, DTS can't complete (as a package).
As an alternative, I could probably detect if a file is empty then decide what to do with it, with VB activeX, it might be feasible, question, VB has a command for "FileExist", how about "FileLen" or the like for determining the length of a file?
TIA.
Very helpful. Thank you. However, activeX problem, error obj "string
C:\myDir\file1.csv" required, the code seems to be correct.
' File Size
' check file size if empty | 0 quit
Option Explicit
Function Main()
Dim oFSO
Dim oFile
Dim sSourceFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set sSourceFile = "C:\myDir\file1.csv"
Set sSourceFileV = sSourceFile.Value
Set oFile = oFSO.GetFile(sSourceFileV)
If oFile.Size > 0 Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If
' Clean Up
Set oFile = Nothing
Set oFSO = Nothing
End Function
Never mind about the activeX error, the objFile.Value attribute was
unnecessary. But the "connectors" does not seem to have an option to
connect this ActiveX script with a package and making sure run the
ActiveX script first, instead of last.
TIA.
Hi
You can use workflow to govern the order of the steps, if you had one or
more files to process then you can use the looping example http://www.sqldts.com/default.aspx?246, although I would expect a three way
split for in the shouldILoop procedure or a second comparison step to cater
for files with size, files with no size and no files to process.
In your code sSourceFileV is not needed, use
Set oFile = oFSO.GetFile(sSourceFile)
John
"NickName" <da****@rock.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... Very helpful. Thank you. However, activeX problem, error obj "string C:\myDir\file1.csv" required, the code seems to be correct.
' File Size ' check file size if empty | 0 quit
Option Explicit
Function Main()
Dim oFSO Dim oFile Dim sSourceFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set sSourceFile = "C:\myDir\file1.csv"
Set sSourceFileV = sSourceFile.Value
Set oFile = oFSO.GetFile(sSourceFileV)
If oFile.Size > 0 Then Main = DTSTaskExecResult_Success Else Main = DTSTaskExecResult_Failure End If ' Clean Up Set oFile = Nothing Set oFSO = Nothing End Function
Hi
You can use workflow to determine the order of execution.
John
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Cigdem |
last post by:
Hello,
I am trying to parse the XML files that the user selects(XML files are
on anoher OS400 system called "wkdis3"). But i am permenantly getting
that error:
Directory0: \\wkdis3\ROOT\home...
|
by: g |
last post by:
I'd like to have a CSS file for everything that's common to my site,
and other CSS files that are specific to certain pages or groups of
pages. When a page loads, it would load in BOTH the General...
|
by: bruce |
last post by:
hi...
it appears that i'm running into a possible problem with
mechanize/browser/python rgarding the "select_form" method. i've tried the
following and get the error listed:
br.select_form(nr...
|
by: Martin Höfling |
last post by:
Hi there,
is it possible to put the methods of a class in different files? I just
want to order them and try to keep the files small.
Regards
Martin
|
by: venkatbo |
last post by:
Hi all,
I have python2.4 running on ppc-linux 2.6.17. I'm attempting to get
a TurboGears 0.9a9 (using CherryPy 2.2.1) based app running on
it.
During the TG-app startup sequence, it reaches...
|
by: Rotem |
last post by:
Hi,
Maybe I'm repeating a previous post (please correct me if I am).
I've tried the following code in python 2.5 (r25:51908, Oct 6 2006,
15:22:41)
example:
from __future__ import...
|
by: Timofmars |
last post by:
I'm try to Unload DB2 data from a table into a record sequential file
on NT. I can an unload on Mainframe, but it doesn't seem to be an
option in NT.
In NT, all I can do is export/import. I can...
|
by: Steven W. Orr |
last post by:
This is all an intro learning experience for me, so please feel free to
explain why what I'm trying to do is not a good idea.
In the Cookbook, they have a recipe for how to create global...
|
by: Stef Mientki |
last post by:
hello,
I've a graphical application (wxPython),
where the code in the main GUI loop is given below.
1 JAL_Loaded = False
2 while len(App_Running) 0:
3 if JALsPy_globals.State...
|
by: Chris Allen |
last post by:
Hello fellow pythoneers. I'm stumped on something, and I was hoping
maybe someone in here would have an elegant solution to my problem.
This is the first time I've played around with packages, so...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |