sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.37k stars 405 forks source link

[FORMATTING] Will not format #Temp Tables #745

Closed bharris6avera closed 3 weeks ago

bharris6avera commented 5 months ago

Input data

Which SQL and options did you provide as input?

Select *
From #temp as A
left join table as B 
    on A.ID = B.ID

Expected Output

Select
    *
From
    #temp as A
    left join table as B on A.ID = B.ID

Actual Output

Unable to format SQL: Error: Parse error: Unexpected "#temp as A" at line 4 column 5

Usage

nene commented 5 months ago

This works fine, but you have to select Transact-SQL as the SQL dialect that you're formatting.

I guess you're probably using this library through prettier-plugin-sql. Just configure dialect: 'transactsql'