Solved

How to convert transfer data from cvs file to table using SSIS package?

Posted on 2014-02-09
4
1,488 Views
Last Modified: 2016-02-10
I have csv file in my network shared folder so i need to transfer all those csv file to table in DB..

csv file

Data.csv

  Zone               Employee               EmpID        Date
 North       Alarcon, Vanessa             1425114      20140502
 North      Appelgren, Richard             1425144     20140502
 North      Appelgren, Richard             1425144     20140502
 North      Austin, Benjamin             1425042     20140502

Data(table in sql db)


When  i am reading from csv file i am unable to read full name of employee column from csv file because employee full name was separated by a column.How can i fix this problem ??And date column in csv file is in different format how can i fix this and get in 2/5/2014 format.?
Can you please help me guys??
0
Comment
Question by:GreatLakes07
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
Tony303 earned 500 total points
ID: 39846308
OK,

Several Options...
Lets look at the Employee ccolumn first...
1. If the csv file has this data with "double quotes" at the start and end of the field then use the TEXT QUALIFIER as " in your Connection Manager connection for the csv.

2. If there is no "double quotes" then it is 2 columns and it would seem the EmpID would actually be the christian name. IE Vanessa, Richard and Benjamin.
If so, then you may have to do a concatenate later to bring the 2 values together.

Now the date column.
Add a data conversion task after the csv source and before the OLE DB destination task. Transform from the string provided in the csv and convert it to a date.

I hope this helps a bit.
T
0
 

Author Closing Comment

by:GreatLakes07
ID: 39846311
Exceptionally good.
0
 

Author Comment

by:GreatLakes07
ID: 39846314
Yes i fixed the problem but while converting to date format i am getting error :(
0
 
LVL 12

Expert Comment

by:Tony303
ID: 39846338
Hey,

Thanks for the points and comments. I appreciate it.
Have a wee look here for the date conversion thing in SSIS...

http://blogs.msdn.com/b/mattm/archive/2010/08/04/string-to-date-conversion.aspx

(I must admit, I generally pull all the csv stuff in to a load table, all raw, warts and all. Then I clean it up with a SQL statement so, for this I'd Convert the date in SQL rather than SSIS).

T
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

743 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

12 Experts available now in Live!

Get 1:1 Help Now