sql-formatter-org / sql-formatter

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

[FORMATTING] Will not format #Temp Tables #745

Open bharris6avera opened 4 weeks ago

bharris6avera commented 4 weeks 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 4 weeks 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'