Creating dynamic table [message #408196] |
Mon, 15 June 2009 04:30  |
Rocky9
Messages: 6 Registered: June 2009
|
Junior Member |
|
|
Hello Everybody,
I want a help in creating dynamic table as per the csv file. The csv file which is to be uploaded does not have a fixed format (No. of columns). So I want to create table with the same number of column as present in the csv file.
Thanks,
Rocky
|
|
|
Re: Creating dynamic table [message #408201 is a reply to message #408196] |
Mon, 15 June 2009 04:44   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Create an external table with 1000 columns. All are optional.
But I can already predict your next question: how to address these columns dynamically.
Answer: prepare for nightmares. If you get to get some sleep at all, that is.
[Updated on: Mon, 15 June 2009 04:45] Report message to a moderator
|
|
|
|
Re: Creating dynamic table [message #408225 is a reply to message #408196] |
Mon, 15 June 2009 06:53   |
Rocky9
Messages: 6 Registered: June 2009
|
Junior Member |
|
|
Hi,
Thanks, for answering my query. My problem is that after the user uploads the csv file, I have to populate the csv file in the table. Also the uploaded csv file doesn't have fix number of columns. This whole thing I have to complete inside Stored Procedure. So, I just want to know how could I achieve this? I guess I might have clear my problem.
Thanks,
Rocky
|
|
|
|
Re: Creating dynamic table [message #408239 is a reply to message #408196] |
Mon, 15 June 2009 07:21   |
Rocky9
Messages: 6 Registered: June 2009
|
Junior Member |
|
|
hi,
As I said the number of columns are not constant.
For eg: One csv file can have 4 columns.
Second csv file can have 7 columns.
I just want to store the contents of this csv in some table, and thereafter use this table to analyze this data and store required data. After the analyzing, I can drop the table in which the contents of csv file were stored.
Thanks,
Rocky
|
|
|
|
Re: Creating dynamic table [message #408372 is a reply to message #408196] |
Mon, 15 June 2009 23:50   |
Rocky9
Messages: 6 Registered: June 2009
|
Junior Member |
|
|
Hi,
My idea behind this is that I would read the header of the file first, and then I would create the table with the datatype set to varchar for all columns. This table can then be dropped after loading the data in the required table after analyzing.
Thanks,
Rocky
[Updated on: Mon, 15 June 2009 23:51] Report message to a moderator
|
|
|
|
|
|
|
|