Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an excel sheet with 10 columns.

i want this to be imported into sql via 3 tables.

table1
table2
table3

table1 will have 4 columns and fkey from table2 and table3.
table2 will have 8 columns
table3 will have 8 columns.

how to accomplish this using the importdata under database tasks?.

Please help.
Thanks
Posted

Are the tables staying in excel, and you want SQL to read from the workbook? If you have already created the database in management studio, you could save each table as a .csv file and upload that way. If you can clarify, I can help you.

Also, what version of SQL and Excel are you using?
 
Share this answer
 
Comments
Member 10562713 16-Aug-14 18:33pm    
I have a single excel sheet with 20 columns or so.
I have three tables created in sql- one with 4columns 2 fkey columns,two other tables with 8 columns.
You may create a plain table in SQL Server and import Excel data into it.

Then you may execute SQL code to create normalized data in your tables.

Try the SaveToDB add-in for Excel[^].
It allows saving data into database tables from Excel. It is free.

If you need to repeat this task periodically, you may customize saving data in add-in using stored procedures. It is the same task you need. But this is an Enterprise edition feature.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900