DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

GENERATE_SERIES syntax is not recognized

Open arvindshmicrosoft opened this issue 3 years ago • 3 comments

  • SqlPackage or DacFx Version: 160.6164.0-preview
  • .NET Framework (Windows-only) or .NET Core: Framework 4.8
  • Environment (local platform and source/target platforms): Windows AnyCPU

Steps to Reproduce:

SELECT value FROM GENERATE_SERIES(START = 1, STOP = 5);
SELECT value FROM GENERATE_SERIES(START = 1, STOP = 32, STEP = 7);
SELECT value FROM GENERATE_SERIES(START = 1, STOP = 5) ORDER BY value;

Parsing this using TSqlParser160 yields:

46010 @ 1,41: Incorrect syntax near =.
46010 @ 2,41: Incorrect syntax near =.
46010 @ 3,41: Incorrect syntax near =.

Did this occur in prior versions? If not - which version(s) did it work in? No, this is not a regression as this is new functionality in SQL Server 2022.

arvindshmicrosoft avatar May 25 '22 18:05 arvindshmicrosoft

This is on the backlog now for future completion - thanks!

dzsquared avatar May 31 '22 18:05 dzsquared

To clarify, the sample T-SQL is incorrect syntax, the correct syntax is

SELECT value FROM GENERATE_SERIES(1, 5);
SELECT value FROM GENERATE_SERIES(1, 32, 7);
SELECT value FROM GENERATE_SERIES(1, 5) ORDER BY value;

This syntax actually parses correctly with TSql160Parser, but we are working to support this in the other parts of DacFx such as model building, model compare, etc.

zijchen avatar Sep 15 '22 15:09 zijchen

To clarify, the sample T-SQL is incorrect syntax, the correct syntax is

SELECT value FROM GENERATE_SERIES(1, 5);
SELECT value FROM GENERATE_SERIES(1, 32, 7);
SELECT value FROM GENERATE_SERIES(1, 5) ORDER BY value;

This syntax actually parses correctly with TSql160Parser, but we are working to support this in the other parts of DacFx such as model building, model compare, etc.

Yes, thank you for pointing this out. The original issue was created for SQL Server 2022 CTP 2.0. Subsequently, the syntax for GENERATE_SERIES changed to not require named parameters. Feel free to close this issue and open a separate one if needed to track the rest of the work in the DacFx ecosystem.

arvindshmicrosoft avatar Sep 15 '22 17:09 arvindshmicrosoft