Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bulk Insert Text file - Create Column Names In New Table

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
US
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.

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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top