Solved

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

Posted on 2014-02-09
4
1,499 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

930 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