Skip to content

Failed to parse SQL Server ddl (alter table a_test add c1 int, c2 int, c3 int) #1651

Closed

Description

@wangziyang

An error is reported when calling (the public static Statement parse(String sql, Consumer consumer) )method

net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "c2" <S_IDENTIFIER>
at line 1, column 31.

Was expecting one of:

"ADD"
"ALGORITHM"
"ALTER"
"CHANGE"
"COMMENT"
"DROP"
"MODIFY"
"RENAME"


at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:190)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:63)

Activity

  1. manticore-projects commented on Oct 24, 2022

    @manticore-projects
    Contributor

    Greetings.

    The supported ALTER TABLE syntax is shown here: https://manticore-projects.com/JSQLParser/_static/JSqlParserCC.xhtml#AlterExpression

    If you wanted to used multiple ALTER EXPRESSIONs (which is supported), then you would comma-separate them and start each with the Command. E. g.

    ALTER TABLE ADD ,,,, ADD ..., ADD ...
    ;
  2. manticore-projects commented on Nov 12, 2022

    @manticore-projects
    Contributor

    No feedback and no further questions asked. Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions