I created the following console application with a reference to Microsoft.SqlServer.TransactSql.ScriptDom.dll:
Imports Microsoft.SqlServer.TransactSql.ScriptDom
Imports System.IO
Module Module1
Sub Main()
Dim sql = "SELECT * FROM Product OPTION(USE HINT('ENABLE_PARALLEL_PLAN_PREFERENCE'))"
Dim parser As New TSql130Parser(False)
Dim errors As Collections.Generic.IList(Of ParseError)
Dim script As TSqlScript = parser.Parse(New StringReader(sql), errors)
Console.WriteLine(errors(0).Message)
Console.ReadKey()
End Sub
End Module
Running this console application produces the following output:
Incorrect syntax near HINT.
But this SQL fragment is correctly parsed in Microsoft SQL Server Management Studio.
It seems therefore, that TSql130Parser does not work correctly. Do you know if there is a fix for this?