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

%sql fails when query contains a Negative number

Open feverittm opened this issue 4 years ago • 2 comments

When running a valid sql comment that has a negative integer as an argument:

%sql SELECT DATEADD(month, -2, SYSDATE)

It returns an error:

UsageError: unrecognized arguments: -2, SYSDATE)

If you make the '-2' a string and cast it to an INT then it works:

%sql SELECT DATEADD(month, '-2'::INT, SYSDATE)

Works.

feverittm avatar Feb 10 '21 23:02 feverittm

have the same issue

acountrec avatar Mar 10 '21 14:03 acountrec

Another workaround is to remove the space before the '-': %sql SELECT DATEADD(month,-2, SYSDATE)

duncandewhurst avatar May 09 '21 21:05 duncandewhurst