You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/02/21 00:32:11 UTC

[shardingsphere] branch master updated: Add SQLServer SETUSER, CREATE USER and ALTER USER statements (#15528)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new d0ca771  Add SQLServer SETUSER, CREATE USER and ALTER USER statements (#15528)
d0ca771 is described below

commit d0ca7711d4050f2d028d97538dfbec4f7cb50ccb
Author: Thanoshan MV <48...@users.noreply.github.com>
AuthorDate: Mon Feb 21 06:01:05 2022 +0530

    Add SQLServer SETUSER, CREATE USER and ALTER USER statements (#15528)
    
    * add setuser, create user, alter user grammar
    
    * add setuser, createuser and alteruser statements
---
 .../src/main/antlr4/imports/sqlserver/BaseRule.g4  |  2 +-
 .../main/antlr4/imports/sqlserver/DCLStatement.g4  | 89 +++++++++++++++++++++-
 .../src/main/antlr4/imports/sqlserver/Keyword.g4   |  9 +++
 .../src/main/antlr4/imports/sqlserver/Literals.g4  |  6 +-
 .../antlr4/imports/sqlserver/SQLServerKeyword.g4   | 28 +++++++
 .../sql/parser/autogen/SQLServerStatement.g4       |  1 +
 .../impl/SQLServerDCLStatementSQLVisitor.java      | 83 +++++++++++++++++++-
 .../core/database/visitor/SQLVisitorRule.java      |  2 +
 .../sqlserver/dcl/SQLServerAlterUserStatement.java |  7 ++
 ...atement.java => SQLServerSetUserStatement.java} | 14 +++-
 .../asserts/statement/dcl/DCLStatementAssert.java  |  5 ++
 .../sqlserver/SQLServerSetUserStatementAssert.java | 49 ++++++++++++
 .../jaxb/cases/domain/SQLParserTestCases.java      |  5 ++
 .../domain/segment/impl/user/ExpectedUser.java     |  9 ++-
 .../dcl/SetUserStatementTestCase.java}             | 13 +++-
 .../src/main/resources/case/dal/show.xml           |  2 +-
 .../src/main/resources/case/dcl/alter-user.xml     |  4 +
 .../src/main/resources/case/dcl/create-user.xml    |  9 +++
 .../src/main/resources/case/dcl/set-user.xml       | 24 ++++++
 .../resources/sql/supported/dcl/alter-user.xml     |  4 +
 .../resources/sql/supported/dcl/create-user.xml    |  9 +++
 .../main/resources/sql/supported/dcl/set-user.xml  | 22 ++++++
 22 files changed, 380 insertions(+), 16 deletions(-)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
index bc8a450..c9a2574 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
@@ -110,7 +110,7 @@ unreservedWord
     | AUTO_CLEANUP | CHANGE_TRACKING | AUTOMATIC_TUNING | FORCE_LAST_GOOD_PLAN | AUTO_UPDATE_STATISTICS_ASYNC | AUTO_UPDATE_STATISTICS | AUTO_SHRINK | AUTO_CREATE_STATISTICS | INCREMENTAL | AUTO_CLOSE
     | DATA_RETENTION | TEMPORAL_HISTORY_RETENTION | EDITION | MIXED_PAGE_ALLOCATION | DISABLED | ALLOWED | HADR | MULTI_USER | RESTRICTED_USER | SINGLE_USER | OFFLINE | EMERGENCY | SUSPEND | DATE_CORRELATION_OPTIMIZATION
     | ELASTIC_POOL | SERVICE_OBJECTIVE | DATABASE_NAME | ALLOW_CONNECTIONS | GEO | NAMED | DATEFIRST | BACKUP_STORAGE_REDUNDANCY | FORCE_FAILOVER_ALLOW_DATA_LOSS | SECONDARY | FAILOVER | DEFAULT_FULLTEXT_LANGUAGE
-    | DEFAULT_LANGUAGE | INLINE | NESTED_TRIGGERS | TRANSFORM_NOISE_WORDS | TWO_DIGIT_YEAR_CUTOFF | PERSISTENT_LOG_BUFFER | DIRECTORY_NAME | DATEFORMAT | DELAYED_DURABILITY | TRANSFER
+    | DEFAULT_LANGUAGE | INLINE | NESTED_TRIGGERS | TRANSFORM_NOISE_WORDS | TWO_DIGIT_YEAR_CUTOFF | PERSISTENT_LOG_BUFFER | DIRECTORY_NAME | DATEFORMAT | DELAYED_DURABILITY | TRANSFER | SCHEMA | PASSWORD
     ;
 
 databaseName
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
index 349660b..5378116 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
@@ -164,8 +164,82 @@ roleClause
     : ignoredIdentifiers
     ;
 
+setUser
+    : SETUSER (stringLiterals (WITH NORESET)?)?
+    ;
+
 createUser
     : CREATE USER
+    (createUserLoginClause 
+    | createUserWindowsPrincipalClause 
+    | createUserLoginWindowsPrincipalClause
+    | createUserWithoutLoginClause
+    | createUserFromExternalProviderClause
+    | createUserWithDefaultSchema
+    | createUserWithAzureActiveDirectoryPrincipalClause
+    | userName)?
+    ;
+
+createUserLoginClause
+    : userName ((FOR | FROM) LOGIN loginName)? (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)?
+    ;
+
+createUserWindowsPrincipalClause
+    : windowsPrincipal (WITH optionsList (COMMA_ optionsList)*)?
+    | userName WITH PASSWORD EQ_ stringLiterals (COMMA_ optionsList (COMMA_ optionsList)*)?
+    | azureActiveDirectoryPrincipal FROM EXTERNAL PROVIDER
+    ;
+
+createUserLoginWindowsPrincipalClause
+    : ((windowsPrincipal ((FOR | FROM) LOGIN windowsPrincipal)?) | (userName (FOR | FROM) LOGIN windowsPrincipal))
+    (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)?
+    ;
+
+createUserWithoutLoginClause
+    : userName (WITHOUT LOGIN (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)?
+    | (FOR | FROM) CERTIFICATE identifier
+    | (FOR | FROM) ASYMMETRIC KEY identifier)
+    ;
+
+optionsList
+    : DEFAULT_SCHEMA EQ_ schemaName
+    | DEFAULT_LANGUAGE EQ_ (NONE | identifier)
+    | SID EQ_ (NCHAR_TEXT | HEX_DIGIT_)
+    | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)?
+    ;
+
+limitedOptionsList
+    : DEFAULT_SCHEMA EQ_ schemaName
+    | DEFAULT_LANGUAGE EQ_ (NONE | identifier)
+    | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)?
+    ;
+
+createUserFromExternalProviderClause
+    : userName ((FOR | FROM) LOGIN loginName)? | FROM EXTERNAL PROVIDER (WITH limitedOptionsList (COMMA_ limitedOptionsList)*)?
+    ;
+
+createUserWithDefaultSchema
+    : userName ((FOR | FROM) LOGIN loginName | WITHOUT LOGIN)? (WITH DEFAULT_SCHEMA EQ_ schemaName)?
+    ;
+
+createUserWithAzureActiveDirectoryPrincipalClause
+    : azureActiveDirectoryPrincipal FROM EXTERNAL PROVIDER (WITH DEFAULT_SCHEMA EQ_ schemaName)?
+    ;
+
+windowsPrincipal
+    : userName
+    ;
+
+azureActiveDirectoryPrincipal
+    : userName
+    ;
+
+userName
+    : ignoredNameIdentifier | NAME_
+    ;
+
+ignoredNameIdentifier
+    : identifier (DOT_ identifier)?
     ;
 
 dropUser
@@ -173,7 +247,20 @@ dropUser
     ;
 
 alterUser
-    : ALTER USER
+    : ALTER USER userName (WITH setItem (COMMA_ setItem)* | FROM EXTERNAL PROVIDER)
+    ;
+
+setItem
+    : NAME EQ_ userName
+    | DEFAULT_SCHEMA EQ_ (schemaName | NULL)
+    | LOGIN EQ_ loginName
+    | PASSWORD EQ_ stringLiterals (OLD_PASSWORD EQ_ stringLiterals)?
+    | DEFAULT_LANGUAGE EQ_ (NONE | identifier)
+    | ALLOW_ENCRYPTED_VALUE_MODIFICATIONS EQ_ (ON | OFF)?
+    ;
+
+loginName
+    : ignoredNameIdentifier | NAME_
     ;
 
 createRole
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
index b1c9ce5..66c214d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
@@ -683,3 +683,12 @@ READONLY
 AT
     : A T
     ;
+
+PASSWORD
+    : P A S S W O R D
+    ;
+
+WITHOUT
+    : W I T H O U T
+    ;
+
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Literals.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Literals.g4
index 7e4e88e..19ac133 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Literals.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/Literals.g4
@@ -20,7 +20,7 @@ lexer grammar Literals;
 import Alphabet, Symbol;
 
 IDENTIFIER_
-    : LBT_? DQ_? [a-zA-Z_$#\u0080-\uFFFF][a-zA-Z0-9_$#\u0080-\uFFFF]* DQ_? RBT_?
+    : LBT_? DQ_? [a-zA-Z_$#\u0080-\uFFFF][a-zA-Z0-9_$#\u0080-\uFFFF\\@/]* DQ_? RBT_?
     ;
 
 STRING_
@@ -65,3 +65,7 @@ fragment DIGIT
 fragment HEX_
     : [0-9a-fA-F]
     ;
+
+NAME_
+    : LBT_ [a-zA-Z_$#\\/@. ]+ RBT_
+    ;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/SQLServerKeyword.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/SQLServerKeyword.g4
index ad80eae..b14950d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/SQLServerKeyword.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/SQLServerKeyword.g4
@@ -1754,3 +1754,31 @@ WITH_RECOMMENDATIONS
 BATCH_SIZE
     : B A T C H UL_ S I Z E
     ;
+
+SETUSER
+    : S E T U S E R
+    ;
+
+NORESET
+    : N O R E S E T
+    ;
+
+DEFAULT_SCHEMA
+    : D E F A U L T UL_ S C H E M A
+    ;
+
+ALLOW_ENCRYPTED_VALUE_MODIFICATIONS
+    : A L L O W UL_ E N C R Y P T E D UL_ V A L U E UL_ M O D I F I C A T I O N S
+    ;
+
+OLD_PASSWORD
+    : O L D UL_ P A S S W O R D
+    ;
+
+PROVIDER
+    : P R O V I D E R
+    ;
+
+SID
+    : S I D
+    ;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatement.g4
index fda898f..18e653a 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatement.g4
@@ -75,5 +75,6 @@ execute
     | alterLogin
     | call
     | explain
+    | setUser
     ) SEMI_?
     ;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDCLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDCLStatementSQLVisitor.java
index fc44b62..7678e40 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDCLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDCLStatementSQLVisitor.java
@@ -18,8 +18,8 @@
 package org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.impl;
 
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sql.parser.api.visitor.operation.SQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
+import org.apache.shardingsphere.sql.parser.api.visitor.operation.SQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.visitor.type.DCLSQLVisitor;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.AlterLoginContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.AlterRoleContext;
@@ -29,13 +29,21 @@ import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.Cla
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.CreateLoginContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.CreateRoleContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.CreateUserContext;
+import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.CreateUserLoginWindowsPrincipalClauseContext;
+import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.CreateUserWindowsPrincipalClauseContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.DenyContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.DropLoginContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.DropRoleContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.DropUserContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.GrantContext;
+import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.IgnoredNameIdentifierContext;
 import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.RevokeContext;
+import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.SetUserContext;
+import org.apache.shardingsphere.sql.parser.autogen.SQLServerStatementParser.UserNameContext;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment.UserSegment;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerAlterLoginStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerAlterRoleStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerAlterUserStatement;
@@ -48,6 +56,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerDropUserStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerGrantStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerRevokeStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerSetUserStatement;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -105,12 +114,67 @@ public final class SQLServerDCLStatementSQLVisitor extends SQLServerStatementSQL
     
     @Override
     public ASTNode visitCreateUser(final CreateUserContext ctx) {
-        return new SQLServerCreateUserStatement();
+        SQLServerCreateUserStatement result = new SQLServerCreateUserStatement();
+        if (null != ctx.createUserLoginClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserLoginClause().userName()));
+        } else if (null != ctx.createUserWindowsPrincipalClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserWindowsPrincipalClause()));
+        } else if (null != ctx.createUserLoginWindowsPrincipalClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserLoginWindowsPrincipalClause()));
+        } else if (null != ctx.createUserWithoutLoginClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserWithoutLoginClause().userName()));
+        } else if (null != ctx.createUserFromExternalProviderClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserFromExternalProviderClause().userName()));
+        } else if (null != ctx.createUserWithDefaultSchema()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserWithDefaultSchema().userName()));
+        } else if (null != ctx.createUserWithAzureActiveDirectoryPrincipalClause()) {
+            result.getUsers().add((UserSegment) visit(ctx.createUserWithAzureActiveDirectoryPrincipalClause().azureActiveDirectoryPrincipal().userName()));
+        } else {
+            result.getUsers().add((UserSegment) visit(ctx.userName()));
+        }
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitUserName(final UserNameContext ctx) {
+        UserSegment result = new UserSegment();
+        String user = null != ctx.ignoredNameIdentifier() ? ((IdentifierValue) visit(ctx.ignoredNameIdentifier())).getValue() : (new IdentifierValue(ctx.NAME_().getText())).getValue();
+        result.setUser(user);
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitIgnoredNameIdentifier(final IgnoredNameIdentifierContext ctx) {
+        int identifierCount = ctx.identifier().size();
+        IdentifierValue result = 1 == identifierCount ? (IdentifierValue) visit(ctx.identifier(0)) : new IdentifierValue(ctx.getText());
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitCreateUserWindowsPrincipalClause(final CreateUserWindowsPrincipalClauseContext ctx) {
+        UserSegment result;
+        if (null != ctx.windowsPrincipal()) {
+            result = (UserSegment) visit(ctx.windowsPrincipal().userName());
+        } else if (null != ctx.azureActiveDirectoryPrincipal()) {
+            result = (UserSegment) visit(ctx.azureActiveDirectoryPrincipal().userName());
+        } else {
+            result = (UserSegment) visit(ctx.userName());
+        }
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitCreateUserLoginWindowsPrincipalClause(final CreateUserLoginWindowsPrincipalClauseContext ctx) {
+        UserSegment result;
+        result = null != ctx.userName() ? (UserSegment) visit(ctx.userName()) : (UserSegment) visit(ctx.windowsPrincipal(0));
+        return result;
     }
     
     @Override
     public ASTNode visitAlterUser(final AlterUserContext ctx) {
-        return new SQLServerAlterUserStatement();
+        SQLServerAlterUserStatement result = new SQLServerAlterUserStatement();
+        result.setUser((UserSegment) visit(ctx.userName()));
+        return result;
     }
     
     @Override
@@ -163,4 +227,17 @@ public final class SQLServerDCLStatementSQLVisitor extends SQLServerStatementSQL
     public ASTNode visitDropLogin(final DropLoginContext ctx) {
         return new SQLServerDropLoginStatement();
     }
+    
+    @Override
+    public ASTNode visitSetUser(final SetUserContext ctx) {
+        SQLServerSetUserStatement result = new SQLServerSetUserStatement();
+        if (null != ctx.stringLiterals()) {
+            UserSegment userSegment = new UserSegment();
+            userSegment.setUser(((StringLiteralValue) visit(ctx.stringLiterals())).getValue());
+            userSegment.setStartIndex(ctx.stringLiterals().start.getStartIndex());
+            userSegment.setStopIndex(ctx.stringLiterals().stop.getStopIndex());
+            result.setUser(userSegment); 
+        }
+        return result;
+    }
 }
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 86f07cd..2b656c1 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -246,6 +246,8 @@ public enum SQLVisitorRule {
     
     RENAME_USER("RenameUser", SQLStatementType.DCL),
     
+    SET_USER("SetUser", SQLStatementType.DCL),
+    
     CREATE_ROLE("CreateRole", SQLStatementType.DCL),
     
     ALTER_ROLE("AlterRole", SQLStatementType.DCL),
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java
index 203703f..aa3c98b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java
@@ -17,13 +17,20 @@
 
 package org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.AlterUserStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment.UserSegment;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement;
 
 /**
  * SQLServer alter user statement.
  */
 @ToString
+@Getter
+@Setter
 public final class SQLServerAlterUserStatement extends AlterUserStatement implements SQLServerStatement {
+    
+    private UserSegment user;
 }
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerSetUserStatement.java
similarity index 70%
copy from shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java
copy to shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerSetUserStatement.java
index 203703f..79b5cfb 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerAlterUserStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/dcl/SQLServerSetUserStatement.java
@@ -17,13 +17,21 @@
 
 package org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.AlterUserStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.DCLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment.UserSegment;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement;
 
 /**
- * SQLServer alter user statement.
+ * SQLServer set user statement.
  */
 @ToString
-public final class SQLServerAlterUserStatement extends AlterUserStatement implements SQLServerStatement {
+@Getter
+@Setter
+public final class SQLServerSetUserStatement extends AbstractSQLStatement implements DCLStatement, SQLServerStatement {
+    
+    private UserSegment user;
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/DCLStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/DCLStatementAssert.java
index 6d6d1b0..f8ff44f 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/DCLStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/DCLStatementAssert.java
@@ -36,6 +36,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerCreateLoginStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerDenyUserStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerDropLoginStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerSetUserStatement;
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.AlterLoginStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.AlterRoleStatementAssert;
@@ -53,6 +54,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.SetDefaultRoleStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.SetPasswordStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.SetRoleStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.sqlserver.SQLServerSetUserStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.AlterLoginStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.AlterRoleStatementTestCase;
@@ -70,6 +72,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetDefaultRoleStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetPasswordStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetRoleStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetUserStatementTestCase;
 
 /**
  * DCL statement assert.
@@ -117,6 +120,8 @@ public final class DCLStatementAssert {
             SetDefaultRoleStatementAssert.assertIs(assertContext, (MySQLSetDefaultRoleStatement) actual, (SetDefaultRoleStatementTestCase) expected);
         } else if (actual instanceof MySQLSetPasswordStatement) {
             SetPasswordStatementAssert.assertIs(assertContext, (MySQLSetPasswordStatement) actual, (SetPasswordStatementTestCase) expected);
+        } else if (actual instanceof SQLServerSetUserStatement) {
+            SQLServerSetUserStatementAssert.assertIs(assertContext, (SQLServerSetUserStatement) actual, (SetUserStatementTestCase) expected);
         }
     }
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/impl/sqlserver/SQLServerSetUserStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/impl/sqlserver/SQLServerSetUserStatementAssert.java
new file mode 100644
index 0000000..6795a8a
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dcl/impl/sqlserver/SQLServerSetUserStatementAssert.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dcl.impl.sqlserver;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.dcl.SQLServerSetUserStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.SQLSegmentAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetUserStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * SQLServer set user statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class SQLServerSetUserStatementAssert {
+    
+    /**
+     * Assert SQLServer set user statement is correct with expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual SQLServer set user statement
+     * @param expected expected SQLServer set user statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, final SQLServerSetUserStatement actual, final SetUserStatementTestCase expected) {
+        if (null != expected.getUser()) {
+            assertThat(assertContext.getText("Actual user name does not match: "), actual.getUser().getUser(), is(expected.getUser().getName()));
+            SQLSegmentAssert.assertIs(assertContext, actual.getUser(), expected.getUser());
+        }
+    }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index b0679e2..9c799ed 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -91,6 +91,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterAggregateStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterCollationStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterConversionStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl.SetUserStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterDatabaseStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterDefaultPrivilegesTestCase;
 import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AlterDimensionStatementTestCase;
@@ -1120,6 +1121,9 @@ public final class SQLParserTestCases {
     @XmlElement(name = "prepared")
     private final List<PreparedStatementTestCase> preparedStatementTestCases = new LinkedList<>();
     
+    @XmlElement(name = "set-user")
+    private final List<SetUserStatementTestCase> setUserStatementTestCases = new LinkedList<>();
+    
     /**
      * Get all SQL parser test cases.
      *
@@ -1399,6 +1403,7 @@ public final class SQLParserTestCases {
         putAll(showRulesUsedResourceStatementTestCases, result);
         putAll(preparedStatementTestCases, result);
         putAll(showShardingTableRulesUsedKeyGeneratorStatementTestCases, result);
+        putAll(setUserStatementTestCases, result);
         return result;
     }
     // CHECKSTYLE:ON
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java
index b01352f..8bca290 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java
@@ -19,12 +19,17 @@ package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domai
 
 import lombok.Getter;
 import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedIdentifierSQLSegment;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedSQLSegment;
+
+import javax.xml.bind.annotation.XmlAttribute;
 
 /**
  * Expected user.
  */
 @Getter
 @Setter
-public final class ExpectedUser extends AbstractExpectedIdentifierSQLSegment {
+public final class ExpectedUser extends AbstractExpectedSQLSegment {
+    
+    @XmlAttribute(name = "name")
+    private String name;
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dcl/SetUserStatementTestCase.java
similarity index 73%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java
copy to shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dcl/SetUserStatementTestCase.java
index b01352f..414104e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/user/ExpectedUser.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dcl/SetUserStatementTestCase.java
@@ -15,16 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.user;
+package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dcl;
 
 import lombok.Getter;
 import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedIdentifierSQLSegment;
+import lombok.ToString;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.user.ExpectedUser;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 
 /**
- * Expected user.
+ * Set user statement test case.
  */
+@ToString
 @Getter
 @Setter
-public final class ExpectedUser extends AbstractExpectedIdentifierSQLSegment {
+public final class SetUserStatementTestCase extends SQLParserTestCase {
+    
+    private ExpectedUser user;
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
index 71d8505..c746a06 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
@@ -141,7 +141,7 @@
     </show-create-trigger>
 
     <show-create-user sql-case-id="show_create_user">
-        <user name="user1" start-delimiter="`" end-delimiter="`" start-index="17" stop-index="24" />
+        <user name="user1" start-index="17" stop-index="24" />
     </show-create-user>
 
     <show sql-case-id="show_all" />
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/alter-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/alter-user.xml
index 365ac15..27f5e16 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/alter-user.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/alter-user.xml
@@ -63,4 +63,8 @@
     <alter-user sql-case-id="alter_user_set_default_schema" />
     <alter-user sql-case-id="alter_user_rename" />
     <alter-user sql-case-id="alter_user_in_database" />
+    <alter-user sql-case-id="alter_user_set_schema_password_language" />
+    <alter-user sql-case-id="alter_azure_ad_user_with_login" />
+    <alter-user sql-case-id="alter_azure_ad_user_without_login" />
+    <alter-user sql-case-id="alter_user_alias_to_existing_azure_id" />
 </sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/create-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/create-user.xml
index 38ec155..7107745 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/create-user.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/create-user.xml
@@ -54,4 +54,13 @@
     <create-user sql-case-id="create_user_with_asym_key" />
     <create-user sql-case-id="create_user_with_sysid" />
     <create-user sql-case-id="create_user_with_group" />
+    <create-user sql-case-id="create_user_with_for_login" />
+    <create-user sql-case-id="create_user_with_from_login" />
+    <create-user sql-case-id="create_user_with_password_default_language" />
+    <create-user sql-case-id="create_user_with_domain_login" />
+    <create-user sql-case-id="create_user_with_sid" />
+    <create-user sql-case-id="create_user_to_copy_encrypted_data" />
+    <create-user sql-case-id="create_azure_ad_user_with_login" />
+    <create-user sql-case-id="create_azure_ad_user_as_group_from_login" />
+    <create-user sql-case-id="create_azure_ad_user_without_login" />
 </sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/set-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/set-user.xml
new file mode 100644
index 0000000..5058f02
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dcl/set-user.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<sql-parser-test-cases>
+    <set-user sql-case-id="set_user" />
+    <set-user sql-case-id="set_user_with_username">
+        <user name="mary" start-index="8" stop-index="13" />
+    </set-user>
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/alter-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/alter-user.xml
index 32a6cbf..b2b3bbd 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/alter-user.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/alter-user.xml
@@ -65,4 +65,8 @@
     <sql-case id="alter_user_set_default_schema" value="ALTER USER user1 WITH DEFAULT_SCHEMA = schema" db-types="SQLServer" />
     <sql-case id="alter_user_rename" value="ALTER USER user1_bak WITH NAME = user1" db-types="SQLServer" />
     <sql-case id="alter_user_in_database" value="ALTER USER user1 IN DATABASE ds SET arg1='val1'" db-types="PostgreSQL,openGauss" />
+    <sql-case id="alter_user_set_schema_password_language" value="ALTER USER user1 WITH NAME = user1_new, DEFAULT_SCHEMA = Development, PASSWORD = 'W1r77TT98%ab@#' OLD_PASSWORD = 'New Devel0per', DEFAULT_LANGUAGE= French" db-types="SQLServer" />
+    <sql-case id="alter_azure_ad_user_with_login" value="ALTER USER [westus/joe] WITH LOGIN = joe@westus.com" db-types="SQLServer" />
+    <sql-case id="alter_azure_ad_user_without_login" value="ALTER USER [westus/joe] FROM EXTERNAL PROVIDER" db-types="SQLServer" />
+    <sql-case id="alter_user_alias_to_existing_azure_id" value="ALTER USER [westus/joe] WITH LOGIN = joe@westus.com, name= joe_alias" db-types="SQLServer" />
 </sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/create-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/create-user.xml
index 83a2bd8..a7a765e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/create-user.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/create-user.xml
@@ -52,4 +52,13 @@
     <sql-case id="create_user_with_asym_key" value="CREATE USER user1 FROM ASYMMETRIC KEY asym_key" db-types="SQLServer" />
     <sql-case id="create_user_with_sysid" value="CREATE USER user1 WITH SYSID 10000" db-types="PostgreSQL,openGauss"/>
     <sql-case id="create_user_with_group" value="CREATE USER user1 IN GROUP group1,group2" db-types="PostgreSQL,openGauss" />
+    <sql-case id="create_user_with_for_login" value="CREATE USER [Domain1\WindowsUserBarry] FOR LOGIN Domain1\WindowsUserBarry" db-types="SQLServer" />
+    <sql-case id="create_user_with_from_login" value="CREATE USER [Domain1\WindowsGroupManagers] FROM LOGIN [Domain1\WindowsGroupManagers]" db-types="SQLServer" />
+    <sql-case id="create_user_with_password_default_language" value="CREATE USER user1 WITH PASSWORD='RN92piTCh%$!~3K9844 Bl*', DEFAULT_LANGUAGE=[Brazilian], DEFAULT_SCHEMA=[dbo]" db-types="SQLServer" />
+    <sql-case id="create_user_with_domain_login" value="CREATE USER [Contoso\Fritz]" db-types="SQLServer" />
+    <sql-case id="create_user_with_sid" value="CREATE USER user1 WITH PASSWORD = 'a8ea v*(Rd##+', SID = 0x01050000000000090300000063FF0451A9E7664BA705B10E37DDC4B7" db-types="SQLServer" />
+    <sql-case id="create_user_to_copy_encrypted_data" value="CREATE USER [User1] WITH DEFAULT_SCHEMA = dbo, ALLOW_ENCRYPTED_VALUE_MODIFICATIONS = ON" db-types="SQLServer" />
+    <sql-case id="create_azure_ad_user_with_login" value="CREATE USER [bob@contoso.com] FROM LOGIN [bob@contoso.com]" db-types="SQLServer" />
+    <sql-case id="create_azure_ad_user_as_group_from_login" value="CREATE USER [AAD group] FROM LOGIN [AAD group]" db-types="SQLServer" />
+    <sql-case id="create_azure_ad_user_without_login" value="CREATE USER [bob@contoso.com] FROM EXTERNAL PROVIDER" db-types="SQLServer" />
 </sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/set-user.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/set-user.xml
new file mode 100644
index 0000000..f71267e
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dcl/set-user.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<sql-cases>
+    <sql-case id="set_user" value="SETUSER" db-types="SQLServer" />
+    <sql-case id="set_user_with_username" value="SETUSER 'mary'" db-types="SQLServer" />
+</sql-cases>