Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

825 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