dbTalk Databases Forums  

DTS with some File intelligence anyone?

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


Discuss DTS with some File intelligence anyone? in the microsoft.public.sqlserver.dts forum.



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

Default DTS with some File intelligence anyone? - 03-01-2006 , 04:20 AM






Hi folks,
I'm just looking for helpful general pointers, not the actual solution or
any code

I've got to import about 10 files or so into a staging post database and my
aim is simple. If the file is one I haven't imported before (and is therefore
a newer version) I wish to import it (i.e execute the importing DTS package
for that file)
if it's one I have imported (i.e it's old or the same) I don't want to
import it again
I will have a table that I can test the last imported date for that filename

any broad ideas on how to do this checking logic. I'm thinking VBscript, the
FileSystemObject and some branching logic...any better suggestions?

Regards and Thanks in advance
CharlesA

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS with some File intelligence anyone? - 03-01-2006 , 03:39 PM






Hello CharlesA,

I would loop over the files.
Grab the date
Compare with the tabled values

if date == new then import and enter the details in the log
if date == older than that in the table - get rid.

Here is some looping code that you can add your own "middle bit" to.

http://www.sqldts.com/default.aspx?246



Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
Hi folks,
I'm just looking for helpful general pointers, not the actual solution
or
any code
I've got to import about 10 files or so into a staging post database
and my
aim is simple. If the file is one I haven't imported before (and is
therefore
a newer version) I wish to import it (i.e execute the importing DTS
package
for that file)
if it's one I have imported (i.e it's old or the same) I don't want to
import it again
I will have a table that I can test the last imported date for that
filename
any broad ideas on how to do this checking logic. I'm thinking
VBscript, the FileSystemObject and some branching logic...any better
suggestions?

Regards and Thanks in advance
CharlesA



Reply With Quote
  #3  
Old   
Philippe Lacoude
 
Posts: n/a

Default Re: DTS with some File intelligence anyone? - 03-01-2006 , 04:07 PM



Hi Charles,

I encountered the same problem a few months ago.

SQL Server 2005 Integration Services (SSIS) has a new control flow item
called "Foreach Loop Container". This container allows you to loop over a
collection of files. To do so, you have to specify that
- the container is a "Foreach File Enumerator"
- a folder to get files from
- an optional file extension type (like *.csv)

The "Foreach Loop Container" item hosts one or more of sub-items which are
executed once for each file found in the designated folder. One such task
can be an "Execute SQL Task" control flow item, for example. (It can also
be a script task if you absolutely want to code...)

You can pass the name of each file to the sub-item. You do so by specifying
a variable in the variable mapping in the "Foreach Loop Container". This
allows to traverse all files of a folder and take action on (or ignore) the
file. The sub-item is aware of the calling context, or to put it in plain
English, it knows what file is being iterated on at a given time.

No coding involved. Well, no VB script coding involved. Just standard
T-SQL.

Have fun,

Philippe Lacoude




"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Hello CharlesA,

I would loop over the files.
Grab the date
Compare with the tabled values

if date == new then import and enter the details in the log if date ==
older than that in the table - get rid.

Here is some looping code that you can add your own "middle bit" to.

http://www.sqldts.com/default.aspx?246



Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Hi folks,
I'm just looking for helpful general pointers, not the actual solution
or
any code
I've got to import about 10 files or so into a staging post database
and my
aim is simple. If the file is one I haven't imported before (and is
therefore
a newer version) I wish to import it (i.e execute the importing DTS
package
for that file)
if it's one I have imported (i.e it's old or the same) I don't want to
import it again
I will have a table that I can test the last imported date for that
filename
any broad ideas on how to do this checking logic. I'm thinking
VBscript, the FileSystemObject and some branching logic...any better
suggestions?

Regards and Thanks in advance
CharlesA





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

Default RE: DTS with some File intelligence anyone? - 03-02-2006 , 06:09 AM



Thanks Allan and Phillipe,
I feel like I have something to go on now, and I always appreciate it
whenever anyone replies to any of my posts.

Thanks again,
Regards
CharlesA

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.