Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ADO.NET
I have large excel file where the number of column is varied how to save it in SQl server ??? help me....!!!
Posted 17-Jan-13 6:45am
Comments
Sergey Alexandrovich Kryukov at 17-Jan-13 11:51am
   
Save what? Whole file? some data? what? What's the problem?
—SA
akhil tripathi at 17-Jan-13 12:03pm
   
I want to save data in sql server
Sergey Alexandrovich Kryukov at 17-Jan-13 12:26pm
   
You did not answer. What data?! Besides, what did you try?
—SA
akhil tripathi at 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 at 18-Jan-13 1:06am
   
I answered how to model all the excel data in my answer.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is a full detailed video on YouTube just search. Excel to Sql Server
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 398
1 DamithSL 255
2 OriginalGriff 230
3 Zoltán Zörgő 149
4 Dave Kreskowiak 120
0 OriginalGriff 7,575
1 DamithSL 5,529
2 Sergey Alexandrovich Kryukov 5,279
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100