Why you should care
An Alias is an alternative name or reference that can be defined in a T-SQL statement for use within that statement. They are not stored by the SQL server permanently. Usually they are one or two characters long and are not required in any part of the statement. However while they simplify syntax and improve readability, they can also complicate administration and takes a lot of joins in SQL to obtain a complete record which can be an issue in code reliability. They can also hide commands that can resiliency issues as wellBusiness Impacts
It is recommended to avoid using an alias as it masks commands which causes potential risks in the code that can lead to productivity issues. [nz_btn text="Production Risk" target="_self" animate="false" animation_type="ghost" color="pink" size="small" shape="rounded" type="normal" hover_normal="opacity" hover_ghost="fill" link="http://casthighlight.wpengine.com/category/product/indicators-methodology/risk/" icon="icon-office"]CAST Recommendations
References
http://sqlmag.com/t-sql/aliases-t-sql[nz_btn text="Style Guide" target="_self" animate="false" animation_type="ghost" color="turquoise" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="fill" link="https://github.com/Kristories/awesome-guidelines" icon="icon-book"]How we detect
This code insight focuses on how aliases can hide dangerous or inappropriate commands. Prefer using the native command by specifying explicitly the options you needAbout CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.
For reference only. For the complete details please refer the original article
https://doc.casthighlight.com/alt_alias-avoid-using-aliases/
https://doc.casthighlight.com/alt_alias-avoid-using-aliases/
Comments