Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BULK INSERT questions
Message
From
14/01/2009 17:52:06
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Import/Export
Title:
BULK INSERT questions
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01373782
Message ID:
01373782
Views:
70
I am using bulk insert to insert records from a flat pipe delimited file to a table. Here is the script I am using:
BULK INSERT
	MyTable
FROM
	'c:\MyFile.txt'
WITH
(
	FIELDTERMINATOR = '|'
	, ROWTERMINATOR = '|\n'
	, FIRSTROW = 2
)
I have two questions:
First, is there a way to avoid the rows being index based? Is there way to use the column header to determine what field the element belongs in, instead of just skipping the row like I am in the example?

Second (and this might be related to the first question), is there a way to include an auto-incrementing PK field?
Very fitting: http://xkcd.com/386/
Next
Reply
Map
View

Click here to load this message in the networking platform