Skip to content

Some SQL server syntax does not support parsing #1682

Closed

Description

@SconyHui

Hi,
I found it unsupported when parsing part of SQLServer syntax.
example:
1, select [id],[name],[age] from [Student]
Because the column name contains the special symbol "[" or "]"
2, declare @Flag int
set @Flag = 1
Because the column name contains the special symbol "@" in SetStatement
3, begin
...
end
This syntax is not supported
4, use LibName
go
...
go
This syntax is not supported

Activity

  1. manticore-projects commented on Dec 5, 2022

    @manticore-projects
    Contributor

    Greetings.

    Please use the latest JSQLParser 4.5 or better JSQLParser 4.6 Snapshot since all the Syntax are supported.
    Please refer to https://manticore-projects.com/JSQLParser/usage.html#define-the-parser-features for activation of T-SQL Squared Bracket Quotation.

    If you still face challenges, then please provide the specific query, shortened/simplified as much as possible.

  2. SconyHui commented on Dec 5, 2022

    @SconyHui
    Author

    Yes, I'm using version 4.6

  3. SconyHui commented on Dec 5, 2022

    @SconyHui
    Author

    eg:
    select [id],[name],[age] from [Student]
    image

  4. manticore-projects commented on Dec 5, 2022

    @manticore-projects
    Contributor

    Please activate SquaredBracket Quotation.

  5. manticore-projects commented on Dec 5, 2022

    @manticore-projects
    Contributor

    select [id],[name],[age] from [Student]

    You can test it online here.

  6. SconyHui commented on Dec 5, 2022

    @SconyHui
    Author

    Thank you. I'll try

  7. SconyHui commented on Dec 5, 2022

    @SconyHui
    Author

    Thank you. The question has been solved
    But I also have problems using this syntax
    image

  8. manticore-projects commented on Dec 5, 2022

    @manticore-projects
    Contributor

    SET @localVariable is likely not supported.

    You would either need to contribute a PR or sponsor the implementation.

  9. SconyHui commented on Dec 5, 2022

    @SconyHui
    Author

    I will apply to the company

  10. SconyHui commented on Dec 6, 2022

    @SconyHui
    Author

    Hi,
    Is the combination of BEGIIN END and IF not supported
    image

  11. manticore-projects commented on Dec 6, 2022

    @manticore-projects
    Contributor

    Greetings.

    Please refer to https://manticore-projects.com/JSQLParser/_static/JSqlParserCC.xhtml#Block

    1. Begin End Blocks of statements are supported

    2. IF ELSE Statements are supported

    However, your example of IF ELSE with BLOCK is not supported.
    It would depend on a major rewrite and/or refactoring since those constructs are MS SQL Server specific.

  12. SconyHui commented on Dec 6, 2022

    @SconyHui
    Author

    Thank you very much. I will find another way to solve this problem

  13. manticore-projects commented on Dec 6, 2022

    @manticore-projects
    Contributor
  14. added 2 commits that reference this issue on Dec 9, 2022
    f9eee97
    42b429f
  15. wumpz commented on Dec 10, 2022

    @wumpz
    Member

    @manticore-projects Did he sponsor the set improvement?

  16. manticore-projects commented on Dec 10, 2022

    @manticore-projects
    Contributor

    @manticore-projects Did he sponsor the set improvement?

    No. :(
    But I have to parse some MS SQL Server scripts for myself and so I did not mind.

  17. added a commit that references this issue on Dec 22, 2022
    8d9db70
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