sql-formatter-org / sql-formatter-org/sql-formatter
Problem with unicode quotes in Transact-SQL
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
Describe the bug
An Unexpected Error Occurred
Parse error: Unexpected "'@p0' an" at line 5 column 4. SQL dialect used: "transactsql".
Please report this at Github issues page.
Stack Trace:
Error: Parse error: Unexpected "'@p0' an" at line 5 column 4.
SQL dialect used: "transactsql".
at T.default.createParseError (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:278047)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:277813)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:272790)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:287994)
at T.default.reset (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:286521)
at T.S.feed (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:312761)
at Object.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:288132)
at T.default.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16545)
at T.default.format (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16443)
at T.formatDialect (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:307558)
format the SQL text
Actual behavior
What happened instead?
Usage
used: https://sql-formatter-org.github.io/sql-formatter/
used transact-SQL
My input text
select
top @p1 ltrim(rtrim(long_matt_name))
from sl_hbm_matter where matter_uno = @p2 and
CONVERT(DATETIME,CONVERT(VARCHAR(@p3), last_modified))
<= '@p0' and CONVERT(DATETIME,CONVERT(VARCHAR(@p3), sl_entry_date))
>= '@p0' order by sl_entry_date desc
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure in the SQL Formatter web interface using the supplied query and the transactsql dialect. Start by tracing the tokenize, parse, and formatDialect entry points named in the stack trace; done means this input formats successfully without the unexpected-token error, with regression coverage if the existing test structure is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 54/100