I am trying to bulk copy from my .csv file into a SQL Server table, but it's not working.
CSV file content:
empid,first_name,last_name
1,Jeni,G
2,Niki,S
3,Broke,D
SQL Server table structure:
CREATE TABLE [dbo].[emp]
(
[empid] [varchar](109) NOT NULL,
[first_name] [varchar](109) NULL,
[last_name] [varchar](19) NULL
) ON [PRIMARY]
Format file:
11.0
133
1 SQLCHAR 0 0 "\"" 1 empid SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 0 100 "\"\t\"" 2 first_name SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 100 "\"\t\"" 3 last_name SQL_Latin1_General_CP1_CI_AS
Batch script:
BULK INSERT [dbo].[emp] FROM 'C:\emp.csv'
WITH
(FORMATFILE='C:\emp.fmt');
Can anyone please let me know how to achieve bulk copy data from a .CSV file into a SQL Server table? Is there any other possibilities - if so, please let me know!
Thanks,