Reputation: 102
I need to do a bulk insert into table in sql server. Only problem i m facing is the csv i need to import from can have variable column. Sometimes it might have 100 and other times it might be 50. I need to create a table depending on the column number in csv and then do bulk insert. Is this process possible? Thanking you in Advance.
Upvotes: 1
Views: 1438
Reputation: 4081
BULK INSERT requires the table to exists, so I would think the best way is simply to create a little application/program in some language you're familiar with that does the work of creating the table for you.
Upvotes: 1
Reputation: 1338
If the date that is variable does not need to be queried directly - then create a table that has columns for the static elements then the serialise the variable elements into a text field or blob.
Upvotes: 0