dbTalk Databases Forums  

Retrieve Daily Files

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


Discuss Retrieve Daily Files in the microsoft.public.sqlserver.dts forum.



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

Default Retrieve Daily Files - 11-22-2006 , 11:38 AM






Hello,

I would like to be able to pull daily main frame files into my SQL database
on a daily basis. We have the code down in order to get the files from the
mainframe, where we are struggling is with a DTS task to check and see if the
file is for the previous day and then if it is, execute the code to bring the
data into a table. We have a sproc that can mimic what the date part looks
like in the source file:

PRINT 'X' + RIGHT(CAST(DATEPART(YEAR, GETDATE()-1) AS VARCHAR),1)
+ CHAR(64 + DATEPART(MONTH, GETDATE()-1))
+ replicate('0', 2-len(CAST(DATEPART(DAY, GETDATE()-1) AS
VARCHAR))) + CAST(DATEPART(DAY, GETDATE()-1) AS VARCHAR)


but now how do we check to see (what task could we use and how), if the
results of this matches the date part in a filename and if so, pull only
those files into our table?

Thank you in advance for your help!
Patrice




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

Default Re: Retrieve Daily Files - 11-22-2006 , 02:17 PM






Hello Patrice,

So you go and get the files from the mainframe.

Your next question is

Have I processed you before? You know this by reading the name of the file
and parse that and derive the date of the file.

This can be accomplished using a Script Task and the FileSystemObject. You
can loop over fioles and decide whether or not to import them.

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


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


Regards

Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com

Quote:
Hello,

I would like to be able to pull daily main frame files into my SQL
database on a daily basis. We have the code down in order to get the
files from the mainframe, where we are struggling is with a DTS task
to check and see if the file is for the previous day and then if it
is, execute the code to bring the data into a table. We have a sproc
that can mimic what the date part looks like in the source file:

PRINT 'X' + RIGHT(CAST(DATEPART(YEAR, GETDATE()-1) AS VARCHAR),1)
+ CHAR(64 + DATEPART(MONTH, GETDATE()-1))
+ replicate('0', 2-len(CAST(DATEPART(DAY, GETDATE()-1) AS
VARCHAR))) + CAST(DATEPART(DAY, GETDATE()-1) AS VARCHAR)
but now how do we check to see (what task could we use and how), if
the results of this matches the date part in a filename and if so,
pull only those files into our table?

Thank you in advance for your help!
Patrice



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.