I have used SQL Refactor for a while now and really appreciate the features that make it easier to understand existing code, which is what I use it for the most. However, I would like to propose a new feature. I would really like to see a tool in SQL Refactor to remove all unnecessary table aliases. By unnecessary I mean any alias in a query where the table that is aliased only appears once. If the table is joined in twice, like for a self-join, then just leave those alias(s) alone, but remove any other aliases that may appear in the query and replace the alias names with qualified names.
The reason that I’m interested in this feature is two-fold. One, when learning a new schema, I think that it is enough to have to learn one name for each table. To have to learn two names for a table ought to be unnecessary. Secondly, I have run into something I never thought I would see: a stored procedure where the same table in different queries in the procedure are aliased to different values. For example, in one query in the stored procedure the table ‘KpiValue’ is aliased to ‘v’ and in the next query in the same procedure it is aliased to ‘kv’. Yuck.
It seems to me that SQL Refactor probably already has a lot of the stuff in it that this feature would need, so I hope that it wouldn’t be too difficult of a feature to add. Thank you for your time.