Can I do create dynamic table while bulk insert ?

5 pts.
Tags:
SQL Query
Hi, I am Software Engineer, I am using SQL-SERVER, I have a issue with it. I want to write a query to dynamically create a table when using BULK Insert. No of Column is dependent upon no of fields available in first row. Assume that in each row no of column is same.Column name can be any string, like col(0),col1,col2..... etc. Is it possible in SQL. I have a lots of file which have no of columns different. So i need this query which help to to upload data very fast, without creating prior table. Waiting for Expert Reply, My No : 91-9911693850 India Delhi. arunkumar112@gmail.com arun_kumar112@yahoo.co.in Thanks,

Answer Wiki

Thanks. We'll let you know when a new response is added.

The BULK INSERT command requires that the table exist beforehand.

One option you can try would be to create a linked server to a file and do a SELECT INTO command which can create the columns on the fly. Then drop the linked server, and move on to the next file.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following