Background:
I have a table named dbo.table, within my database Data. I then have a .csv file named test.csv I would like to push this test.csv data into my dbo.table within my Data database. How would I go about doing this?
dbo.table
State Customer
Ga John Doe
test.csv
State Customer
NY Carolyn King
Desired Output:
State Customer
Ga John Doe
NY Carolyn King
I wish to insert test.csv data into the dbo.table. I am currently doing a Bulk Insert:
BULK INSERT dbo.table
FROM 'C:\test.csv'
WITH
(
FIRSTROW = 2,
rowterminator='\n',
fieldterminator=',',
tablock
);
However, how would I perform this with a regular Insert query?
Could I do:
INSERT INTO dbo.table SELECT a.* FROM
OPENROWSET
(BULK N'D:\data.csv', FORMATFILE =
'C:\test.csv', CODEPAGE = '65001');
I am unsure of the CODEPAGE....