Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T-SQL rule: Make alias style consistent #2487

Open
fdw opened this issue Jan 26, 2022 · 3 comments
Open

T-SQL rule: Make alias style consistent #2487

fdw opened this issue Jan 26, 2022 · 3 comments
Labels
enhancement to existing rule enhancement New feature or request t-sql Issues related to the T-SQL/TSQL/Transact SQL dialect

Comments

@fdw
Copy link
Contributor

fdw commented Jan 26, 2022

I'm not even sure if rules just for one dialect are possible, but if so, the following would be nice:

T-SQL allows an additional style of aliasing, namely

select
  alias1 = column1

Currently, it's possible to use both even in the same query. It would be nice if sqlfluff could make this consistent (always as, always =, consistent within the query).

@fdw fdw added the enhancement New feature or request label Jan 26, 2022
@tunetheweb
Copy link
Member

To me this could be an extension of L011 or L012. Especially if it forces as - then it would just be a matter of recognising and replacing the = for t-sql.

An extras step would be to offer the option of preferring (=), though as that's T-SQL specific it might be more confusing for others reading the docs.

@fdw
Copy link
Contributor Author

fdw commented Jan 26, 2022

Yes, sounds like L012.

However, I have to say I quite like the = syntax, so I would maybe want to enforce it with sqlfluff. But, as you say, that would make at least the docs more confusing (and likely the code as well).

@barrywhart barrywhart added the t-sql Issues related to the T-SQL/TSQL/Transact SQL dialect label Jan 28, 2022
@infused-kim
Copy link

Yes, sounds like L012.

However, I have to say I quite like the = syntax, so I would maybe want to enforce it with sqlfluff. But, as you say, that would make at least the docs more confusing (and likely the code as well).

Hell yeah... team-= uprising. I finally found another person who prefers the = syntax...

So I am adding another vote for the ability to enforce the = syntax.

@fdw fdw mentioned this issue Feb 27, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement to existing rule enhancement New feature or request t-sql Issues related to the T-SQL/TSQL/Transact SQL dialect
Projects
None yet
Development

No branches or pull requests

4 participants