Hello, have SQL Server 2019 and am trying to BULK INSERT from a .txt file which every column data is wrapped with the double quotes character " and delimited by vertical bar pipe |
This flat file has no column header, contains 1000 records, and 90 Columns.
Microsoft mentions:
https://learn.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql?view=sql-server-2017
FIELDQUOTE = 'field_quote'
Applies to: SQL Server 2017 (14.x).
Here's what I have so far:
BULK INSERT [dbo].[Products]
FROM 'C:\Test_Bulk_Import\Products.txt'
WITH
(
DATAFILETYPE = 'widechar',
FIELDTERMINATOR ='"|"',
FIELDQUOTE = '"',
ROWTERMINATOR ='"\n',
FirstRow=0
);
I get following:
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1000, column 90 (Last_Column_Name).
Strange when I query the table 999 records within .txt file got imported into my target Table (looks like missing 1 record since flat file contains 1000 records) and the very 1st record in 1st Column includes the double quote " character along with its data within that cell. All of the rest of the records/cells within Table look good.
I'm trying to Bulk Insert this without using a Format File or SSIS.
Can this be done since I do have SQL 2019 like Microsoft mentions FIELDQUOTE option should be able to do?
Please note my flat file is .txt file not .csv
Thanks in advance.