Failed to parse SQL Server ddl · Issue #1567 · JSQLParser/JSqlParser · GitHub
Skip to content

Failed to parse SQL Server ddl #1567

Description

@Vipin-Sharma

Steps to Reproduce the Problem:

String ddl = """
CREATE TABLE [Person].[Person]
(
      [BusinessEntityID] [int] NOT NULL,
      [PersonType] [nchar](2) NOT NULL,
      [NameStyle] [dbo].[NameStyle] NOT NULL,
      [Title] [nvarchar](8) NULL,
      [FirstName] [dbo].[Name] NOT NULL,
      [MiddleName] [dbo].[Name] NULL,
      [LastName] [dbo].[Name] NOT NULL,
      [Suffix] [nvarchar](10) NULL,
      [EmailPromotion] [int] NOT NULL,
      [AdditionalContactInfo] [xml](CONTENT [Person].[AdditionalContactInfoSchemaCollection]) NULL,
      [Demographics] [xml](CONTENT [Person].[IndividualSurveySchemaCollection]) NULL,
      [rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
      [ModifiedDate] [datetime] NOT NULL
);
""";
CCJSqlParserUtil.parse(ddl);

CCJSqlParserUtil.parse(ddl) throws error:

Encountered unexpected token: "CREATE" "CREATE"
    at line 1, column 1.

Was expecting one of:

    "("
    "ALTER"
    "CALL"
    "COMMENT"
    "COMMIT"
    "DECLARE"
    "DELETE"
    "DESCRIBE"
    "DROP"
    "EXEC"
    "EXECUTE"
    "EXPLAIN"
    "GRANT"
    "INSERT"
    "MERGE"
    "PURGE"
    "RENAME"
    "RESET"
    "ROLLBACK"
    "SAVEPOINT"
    "SET"
    "SHOW"
    "TRUNCATE"
    "UPDATE"
    "UPSERT"
    "USE"
    "VALUES"
    "WITH"
    <K_SELECT>



Java version: 17
JSQLParser version: 4.4

Activity

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

    DDLDDL statement related

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions