You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the issues and found no similar issues.
What Happened
When I run sqlfluff format file.sql, it fails to format it and I have to do it manually. I did spend enough time to understand where it fails, but I thought I should create a ticket so you have another scenario to look at. Here is the code:
-- Note that normally we would need to recreate the table if we want to perserve the order of columns,-- as there is no way of sorting them. Worth noting that the sql engine doesn't care much about the order when-- explictly querying columns from tables. However since the columns we modify are the last ones, we can-- take a shortcut by droping and then adding them in the right order.-- No longer need default value constraints for it, since it is fixed length binary column.ALTERTABLE USERDATA DROPCONSTRAINT DF_USERDATA_strSkill;
GOALTERTABLE USERDATA ADD
bySkill BINARY (10) NULL,
byItem BINARY (400) NULL,
bySerial BINARY (400) NULL;
GO-- Implicit conversion from data type varchar to binary is not allowed.UPDATE USERDATA SET bySkill =CONVERT(BINARY, strSkill);
-- Note that there is no need to convert these two below to binary, since they were already binary-- and someone forgot or didn't bother to rename them.UPDATE USERDATA SET byItem = strItem;
UPDATE USERDATA SET bySerial = strSerial;
GO-- Done reworking these columns? let's get ride of them.ALTERTABLE USERDATA DROP COLUMN strSkill, strItem, strSerial;
GO
Namely the part with dropping multiple columns:
ALTERTABLE USERDATA DROP COLUMN strSkill, strItem, strSerial;
Search before asking
What Happened
When I run sqlfluff format file.sql, it fails to format it and I have to do it manually. I did spend enough time to understand where it fails, but I thought I should create a ticket so you have another scenario to look at. Here is the code:
Also this breaks:
Namely the part with dropping multiple columns:
Refer to this: https://stackoverflow.com/a/18564014
Expected Behaviour
It should format it without manual intervention.
Observed Behaviour
Had to format manually.
How to reproduce
Create a file out of the code above and run the format with default configs.
Dialect
tsql
Version
2.3.5 installed via pip
Configuration
default
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: