Parse Error in sql File for Temporal Table

Hi!

I think there is a Bug in the Parser for SQL Server Temporal Tables.

WARN: Unable to parse file '/R:/CICD/_W/File.sql' : Parse error at line 10 column 122:

 1: CREATE TABLE [ODS].[FA_CounterpartyMapping_Exclusions_HISTORY]
 2: (
 3:  [Kundennummer] BIGINT NOT NULL PRIMARY KEY,
 4:  [PartyShortname] VARCHAR(50) NULL,
 5:  [Description] VARCHAR(250) NULL,
 6:  [SysStart] DATETIME2 (7) GENERATED ALWAYS AS ROW START HIDDEN NOT NULL DEFAULT CONVERT(DATETIME2, '0001-01-01 00:00:00.0000000'),
 7:  [SysEnd] DATETIME2 (7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.9999999'),
 8:  PERIOD FOR SYSTEM_TIME ([SysStart], [SysEnd])
 9: )
10: WITH (SYSTEM_VERSIONING = ON(HISTORY_TABLE=[ODS].[FA_CounterpartyMapping_Exclusions_HISTORY], DATA_CONSISTENCY_CHECK=ON, HISTORY_RETENTION_PERIOD = 10 YEARS));

SQL Server Dokumentation for Temporal Tables and HISTORY_RETENTION_PERIOD

AzureDevOps Server Pipeline with Sonar Extension 6.2.0
Sonar Enterprise Edition Version 10.4.1 (build 88267)

THX

Hey there.

Can you please share this file in full?

Hi
Thats the hole File. Its only the table.

CREATE TABLE [ODS].[FA_CounterpartyMapping_Exclusions]
(
	[Kundennummer] BIGINT NOT NULL PRIMARY KEY,
	[PartyShortname] VARCHAR(50) NULL,
	[Description] VARCHAR(250) NULL,
	[SysStart] DATETIME2 (7) GENERATED ALWAYS AS ROW START HIDDEN NOT NULL DEFAULT CONVERT(DATETIME2, '0001-01-01 00:00:00.0000000'),
	[SysEnd] DATETIME2 (7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.9999999'),
	PERIOD FOR SYSTEM_TIME ([SysStart], [SysEnd])
)
WITH (SYSTEM_VERSIONING = ON(HISTORY_TABLE=[ODS].[FA_CounterpartyMapping_Exclusions_HISTORY], DATA_CONSISTENCY_CHECK=ON, HISTORY_RETENTION_PERIOD = 10 YEARS));

Hello @ArminPrieschl,

Thank you for reporting this issue!

I was able to reproduce it and I have created a ticket to fix it:

https://sonarsource.atlassian.net/browse/SONARTSQL-337

Have a nice day.