Share via

Why does Synapse On-Demand return same row counts when running queries with UNION ALL?

Valter Prykäri 126 Reputation points
2021-05-19T15:08:27.137+00:00

In the second query, FIRSTROW is set to 2. Running these queries separately will return different counts, but running them in an UNION ALL query, the both values will be the same.

SELECT
    count(*)
FROM
    OPENROWSET(
        BULK 'https://teststorage.dfs.core.windows.net/data/test.csv',
        FORMAT = 'CSV',
        PARSER_VERSION='2.0',
        FIRSTROW = 1,
        FIELDTERMINATOR = ';' ) as res

UNION ALL 

SELECT
    count(*)
FROM
    OPENROWSET(
        BULK 'https://teststorage.dfs.core.windows.net/data/test.csv',
        FORMAT = 'CSV',
        PARSER_VERSION='2.0',
        FIRSTROW = 2,
        FIELDTERMINATOR = ';') as res
Azure Synapse Analytics
Azure Synapse Analytics

An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.