Skip to content

SQLServer errors #877

Open
Open
@archonic

Description

@archonic

Describe the bug
This is similar to this closed issue: #700. I'm unable to format a valid SQLServer statement. Using the demo, there appears to be no language selection that doesn't error.

Expected behavior
Output should be formatted.

Actual behavior
Got this error:

Error: Parse error: Unexpected "[Contact] " at line 1 column 6.
This likely happens because you're using the default "sql" dialect.
If possible, please select a more specific dialect (like sqlite, postgresql, etc).

Usage

import { format } from 'sql-formatter';
let sql_string = "WITH [Contact] AS (SELECT [ContactID], [FirstName], [LastName] FROM [dbo].[Contact])";
format(sql_string, { language: 'sql' })
  • What SQL language(s) does this apply to?
    SQLServer

  • Which SQL Formatter version are you using?

sql

I'm on 15.3.1 so I figured opening a new issue was prudent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions