December 17, 2020 at 10:52 am
I am trying to bulk insert from the below code for the given attached file but it fails.
My code is as below
USE AdventureWorks
IF OBJECT_ID('dbo._export_annual_accounts', 'u') IS NOT NULL
DROP TABLE dbo._export_annual_accounts;
CREATE TABLE [dbo].[_export_annual_accounts]
(
[record-id] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[document-id] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[company] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[city] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[date-published] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[date-from] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[date-to] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[title-1] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL ,
[title-2] [NVARCHAR](1000) COLLATE Latin1_General_CI_AS
NULL
)
ON [PRIMARY]
BULK INSERT dbo._export_annual_accounts
FROM 'D:\File1.csv'
WITH
(
FIELDTERMINATOR = '\t' ,
DATAFILETYPE = 'widechar' ,
ROWTERMINATOR ='0x0a',
FIRSTROW = 2
);
My primary doubt is ROWTERMINATOR but it is not working out for me.
December 17, 2020 at 11:18 am
Check your file in a HEX viewer.
It starts with pretty interesting sequence.
_____________
Code for TallyGenerator
December 17, 2020 at 11:55 am
It looks fine in PilotEdit as well as in Notepad++
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply