I' am trying use the following code to validate a sql query:
Dim sql As String Dim script As Microsoft.SqlServer.SqlParser.SqlCodeDom.SqlScript sql = " SELECT * FROM FROM sys.objects" 'a shared public function, no need to construct an object, so no object.parse method is used. script = Microsoft.SqlServer.SqlParser.Parser.Parser.Parse(sql) For Each s As Microsoft.SqlServer.SqlParser.Parser.Error In script.Errors Debug.Print(s.Message) Next