Home > OS >  Why do I still get the desire results when not specifying the FIELDTERMINATOR here?
Why do I still get the desire results when not specifying the FIELDTERMINATOR here?

Time:08-19

I have the following CSV file:

Number,Letter
1,"A","G"
2,"B","H"
3,"C","I"
4,"D","J"
5,"E,F","K"

I uploaded the CSV file into my Azure storage account. I opened Azure Synapse and ran the following T-SQL:

SELECT *
FROM
    OPENROWSET(
        BULK 'taxi/raw/Sample.csv',
        DATA_SOURCE = 'nyc_taxidata',
        FORMAT = 'CSV',
        PARSER_VERSION = '2.0',
        FIRSTROW=2,
        ROWTERMINATOR = '\n',
        FIELDQUOTE = '"'
    )
    AS [result]

I get the following results:

enter image description here

Why does it work even though I did not use

FIELDTERMINATOR = ','

CodePudding user response:

From the documentation:

<bulk_options>

FIELDTERMINATOR ='field_terminator'

Specifies the field terminator to be used. The default field terminator is a comma (",").

So, as you didn't specify FIELD_TERMINATOR then a comma (,) was used, which is why it worked.

  • Related