Adding Column to Table Corrupts Views - by Michael T. Bunney

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
1
Sign in
to vote
ID 726995 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/28/2012 12:50:35 PM
Access Restriction Public

Description

When you add a column to a table that is referenced by a view using a wildcard, where the view contains additional columns following the wildcard, SQL Server attempts to update the view, but does so incorrectly, corrupting it.
Sign in to post a comment.
Posted by Microsoft on 3/26/2013 at 6:31 AM
Hi,
Thanks for feedback. If a view is not created with the SCHEMABINDING clause, sp_refreshview should be run when changes are made to the objects underlying the view that affect the definition of the view. Otherwise, the view might produce unexpected results when it is queried. The issue does not repro after I ran sp_refreshreview (after adding the column).

Thanks,
Pooja Harjani, Program Manager, SQL Server.
Posted by Phil Brammer on 2/29/2012 at 4:56 PM
This is why you shouldn't ever include select * in a view.