guan404ming commented on code in PR #2186:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2186#discussion_r2755163947


##########
src/dialect/mssql.rs:
##########
@@ -145,7 +145,22 @@ impl Dialect for MsSqlDialect {
     }
 
     fn parse_statement(&self, parser: &mut Parser) -> Option<Result<Statement, 
ParserError>> {
-        if parser.peek_keyword(Keyword::IF) {
+        if parser.parse_keyword(Keyword::BEGIN) {
+            if parser.peek_keyword(Keyword::TRANSACTION)
+                || parser.peek_keyword(Keyword::WORK)
+                || parser.peek_keyword(Keyword::TRY)
+                || parser.peek_keyword(Keyword::CATCH)
+                || parser.peek_keyword(Keyword::DEFERRED)
+                || parser.peek_keyword(Keyword::IMMEDIATE)
+                || parser.peek_keyword(Keyword::EXCLUSIVE)
+                || parser.peek_token_ref().token == Token::SemiColon
+                || parser.peek_token_ref().token == Token::EOF
+            {
+                parser.prev_token();
+                return None;
+            }
+            Some(parser.parse_begin_exception_end())

Review Comment:
   Thanks for the really nice suggestion. I just updated it does more clean and 
work as well.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to