Thursday, January 14, 2016

Using star * in SQL Server Views

Learned a lesson about using star * in views.

If you add new cols in the table that is referenced in the view as * (along with other cols using join), the view will only show same number of columns that it is originally compiled with. 
View definition doesn’t get update right if * is not used in the end.
It keeps the same number of columns and moves the data to wrong columns while trying to return same number of cols.

Never use *.

HTH

No comments: