SQL Bulk Insert

-- create the target table. This is done only once
create table _test02(RowID int, Repname varchar(10), Repcode int)
   
--import the data
BULK INSERT _test02
FROM 'c:\temp\data.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
 
--the quote field terminators in our test file were inconsistent, this fixes them
update _test02 set repname = replace(repname,char(34),'')
 
select * from _test02

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences