Click here to Skip to main content
15,896,402 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have large excel file where the number of column is varied how to save it in SQl server ??? help me....!!!
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jan-13 11:51am    
Save what? Whole file? some data? what? What's the problem?
—SA
akhil tripathi 17-Jan-13 12:03pm    
I want to save data in sql server
Sergey Alexandrovich Kryukov 17-Jan-13 12:26pm    
You did not answer. What data?! Besides, what did you try?
—SA
akhil tripathi 18-Jan-13 0:05am    
I hava Excel file on which columns varied depends upon the User.First row of excel contains column name and remaining row contains data and now the problem is that different user can upload different structure of excel e.g. variable number of columns with data.Now how I can save these type of excel in sql server
Sergey Alexandrovich Kryukov 18-Jan-13 1:06am    
I answered how to model all the excel data in my answer.
—SA

I still cannot here a decent question.

So, just a hint:

You can have two tables: one table represents columns, so the number of columns is variable, as you can add/remove records to/from this table. This table carry no information about the cells under the column.

Another table could represent cells, each cell referencing its column from the table of columns. One of the attributes of the cell record would be a foreign key referencing a master key of the column table.

I ignored rows because you did not ask about them. More realistically, the number of rows are also variable, some can be empty, etc.

With rows, do the same as I described with columns; you would need to add a table or rows. The each cell can reference its row having an external key referencing the master key of the row table. So, each cell references its row/column pair. This is how relational model works.

This way, 3 database table will reproduce one "jagged" spreadsheet. Additionally, you can represent a set of spreadsheets, etc.

—SA
 
Share this answer
 
There is a full detailed video on YouTube just search. Excel to Sql Server
 
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