Solved

load the latest file from FTP to Target table.

Posted on 2012-04-10
2
460 Views
Last Modified: 2012-08-13
Hi,

Requirement : Need to copy the latest  CSV file from FTP Shared drive to my local machine and then need to load it to the Target Table(SQL SERVER 2008) using the SSIS 2008.

Step 1:  Will get the latest file from the FTP Drive using the Script task  as mentioned below

http://www.rad.pasfu.com/index.php?/archives/30-Find-Last-Created-File-in-Special-Directory-SSIS.html

Step 2

After getting the latest file (with time stamp) , I am unsure how to copy it to the folder in my local machine and then rename the file to  a Specified Name("ContactDetails")  as mentioned in the Flat file Connection Manager ?

Example: Files in the FTP Shared Drive

ContactDetailsApril6.csv
ContactDetailsApril7.csv
ContactDetailsApril8.csv
ContactDetailsApril9.csv
ContactDetailsApril10.csv

Here ContactDetailsApril10.csv is the latest file


Could you please help me with the solution in detail and also please suggest that solution mentioned in Step 1 works fine.

Regards,

Sreekanth.
0
Comment
Question by:n_srikanth4
2 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37829033
you have to use ft task for ftp which use for copy file ftp to your location you can use expressions for that to copy files.

and for load in table use dataflow task in which use flate file source and destination as a oldb destination which is to your sql table.

Regards,
nishant
0
 
LVL 11

Accepted Solution

by:
SThaya earned 500 total points
ID: 37831856
1. create 2 variables
Variable 1 : Latest File name
Variable 2 : Local Folder Filename

.---> Variable 1 : this data you will get from your step 1

2. in Control flow drag and drop the "FTP Task " .Set  the the connection and select the opeartion (move the file to the local folder )

Refer :http://f5debug.net/2011/03/15/sql-server-integration-services-ssis-%E2%80%93-part-22-%E2%80%93-receive-file-using-ftp-task-in-ssis-package/

3. place the Script task will assign the "Variable 2 : " file name .

3. Drag and Drop the DataFlow task  and Edit -->set the data sorce as " Flat File "

4. in the flatfileCooection window -->right click ---> properties --> select Expession and set the connection string expression as  [Variable 2 :] this will change your file name automatically.


5 oledb destination will hold your incoming data
Untitled.png
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now