I am using SQL Server 2012, do not have the exact build # handy though.
I created a view:
create view myView as
a.*, b.storeName, b.storeLocation
from
Sales a inner join
Stores b on a.StoresID = b.StoresID
I am certain that the view worked as expected for months. But had an issue with some related code today, and upon inspection the "b.storename" value in the view had nothing to do with the storename -- it was like a different, random column was being displayed in the view in the "storename" column (for discussion purposes, say that the "store manager" values where being displayed in the view under the "storename" column). I then rebuilt the view using the "alter" command, and presto, the "storename" column was back to normal and displaying store names.
My assumption is that putting in "*" in the view creation statement is a bad idea, and if you drop and add columns to the underlying base tables can lead to unexpected results.
Any other theories out there, or has anyone identified a specific related bug to what is being described here?
Thanks, any comments appreciated.