sql-formatter icon indicating copy to clipboard operation
sql-formatter copied to clipboard

A syntax error occurs in SQL formatting when sql code has '!=' operator

Open xingorg1 opened this issue 4 years ago • 0 comments

When sql code has "!= "operator, formatting code gets wrong syntax formatting"! = ". There is an extra space between the "!" symbol and the "=" symbol

for example:

SELECT
  *
FROM
  tableName
WHERE
  dt = '2021-11-09'
  AND some != '111'

i‘ll get it

SELECT
  *
FROM
  tableName
WHERE
  dt = '2021-11-09'
  AND some ! = '111'

Here's how I use it:

import { format as sqlFormatter } from "sql-formatter";

let newVal = "SELECT * FROM tableName WHERE dt='2021-06-09' AND some != '111'"
sqlFormatter(newVal);

[email protected] browser:Chrome@latest

xingorg1 avatar Nov 08 '21 07:11 xingorg1