Oct 19, 2009

How to do Bulkupload to sqlserver

Create the table like this

CREATE TABLE CSVTest
(yearn INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
description varchar(max),amount numeric(12,2))
GO
now prepare the txt file named as test.txt and the put the data
1997,Ford,E350,ac,3000.00
1999,Chevy,Venture,kk,4900.00
1996,Jeep,Grand,Cherokee, 2000
1985, moon, roof, loaded,4799.00

now run this query
BULK
INSERT CSVTest
FROM 'd:\test.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

GO