CSV file to database table
540 pts.
0
Q:
CSV file to database table
Hi Experts,

I have a question is the csv file can be converted to a database table with same column and data
i hav gone through the CSV format tag,not getting idea about this
i just would like to know is there any procedure or sysntax to do this

thanks for the hlp
ASKED: Jun 23 2009  10:57 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
130 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
i used to convert my csv flat file into spreadsheet and import from sql server. But first I had to re-design my sql table from the flat file data and normalise it. The flat file normally contains all the data in one flat format with each field delimited by some char (eg comma). for eample, a payroll flat file will contain the following:

payno, staffid, name, dateofbirth, payrate, hoursworked, salaryamt, department, gender etc

the sql table design will ne something like this

Employee :empid, name, dob,deptid, payrate
Department: departmentid, name
Payroll ; payrollno, empid, hoursworked, Salaryamt

Employee, Department and Payroll are tables with their corresponding fields.

Each of the table can be represented as a sheet in the spreadsheet worksheet. Sql has features to import the data from spreadsheet and I'm sure Oracle have this feature as well.

When you do this type of conversion, it is importand to bear in mind the requirement for referential integrity of the database tables. That is the the mandatory fields must have data. Check out the foreign keys in each table and make sure that they have data. Sometimes the csv files dont have these kind of data and that will be a problem when you create database tables. Csv files is notorious for missing data, this is because most are a result of reports which are actually generated out of database tables themselves.
For example, in my csv example, there is no empid,deptid, departmentid fields. These fields must be created in your spreadsheet and populated before conversion into database tables.

You can also create a small program that reads from the csv file and write directly to the database tables.
Last Answered: Jun 25 2009  1:51 AM GMT by Twlp123   130 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Carlosdl   29855 pts.  |   Jun 23 2009  2:13PM GMT

Hi Inprise.

You didn’t specify what database you are using, but if I remember well, you have been working with Oracle, right ?

Could you please provide more details ?
How do you want to do this ? what tool are you trying to use ?

You could create the table and then import the data using SQL*Loader.

 

Inprise   540 pts.  |   Jun 24 2009  3:22AM GMT

Hi,

Thanks for ur info,yes i am into oracle
i am not clear on wat possiblities work out
jus want to know how to convert flat files to database table (using SQL procedure or command syntax and possibility using tools as well

 

Inprise   540 pts.  |   Jun 24 2009  3:32AM GMT

i need some script kind to convert the data from CSV format and upload into data base table,is that s possible,can u giv me some suggestion on how to proceed on this ?

 
0