SqlScriptDOM icon indicating copy to clipboard operation
SqlScriptDOM copied to clipboard

TSql160Parser misidentifies interval parameter in DATEDIFF function as ColumnReferenceExpression

Open sqlrunner opened this issue 1 year ago • 0 comments

The TSql160Parser incorrectly identifies the interval parameter in the DATEDIFF function as a ColumnReferenceExpression. This issue occurs when parsing expressions like DATEDIFF(mm, ColA, ColB).

Reproduction Steps:

  1. Use the following SQL query: SELECT DATEDIFF(mm, ColA, ColB) FROM my_table;
  2. Parse the query using TSql160Parser.
  3. Observe that the interval parameter mm is identified as a ColumnReferenceExpression.

Expected Behavior: The interval parameter mm should be identified as a Literal or Identifier, not a ColumnReferenceExpression.

Environment Details:

  • SqlScriptDOM version: 161.9142.1
  • .NET version: 8.0
  • Operating System: Windows 10

sqlrunner avatar Oct 10 '24 23:10 sqlrunner