Thread: Bulk Insert
View Single Post
  #5 (permalink)  
Old December 11th, 2007, 05:19 PM
SQLScott's Avatar
SQLScott SQLScott is offline
Wrox Author
Points: 1,121, Level: 13
Points: 1,121, Level: 13 Points: 1,121, Level: 13 Points: 1,121, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can't do it that way. Your table has two columns and you are deliniating the text in the file at all. For example, try this, it works:

File:
JohnGreed
KevinHeath

CREATE TABLE Names
(
  Firstname varchar(20)
)

BULK INSERT Names FROM 'c:\names.txt'

select * from Names

drop table Names

If you are specifying more than one column, you need to provide it MUCH more information that just "hey, here's a file for my bulk insert".

Look in BOL for Bulk Insert. That, plus the above example, should get you started.

========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================
Reply With Quote