Hello,
I have about 100 text files I need to insert into individual databases. I want to avoid using the DTS import wizard which will require me running this 100 individual times.
The problem is that I don't have the tables pre-created. The first row of each .txt file contains the column names.
Is there a way I can create the table and use the first row of each file to create my columns/names, etc as it imports the text file?
Thanks!
I have about 100 text files I need to insert into individual databases. I want to avoid using the DTS import wizard which will require me running this 100 individual times.
Code:
I would like to use bulk insert dbo.MyTable
from 'c:\temp\Text1.txt'
with (FIELDTERMINATOR = ',')
The problem is that I don't have the tables pre-created. The first row of each .txt file contains the column names.
Is there a way I can create the table and use the first row of each file to create my columns/names, etc as it imports the text file?
Thanks!