2

Having once again been bitten by SQL Server not updating all views properly when you add a field to an underlying table (whaaaaaat!), I am wondering if there is a setting in SQL Server that forces it to recompile the view on every use. Then I could switch this on while doing updates and then when done switch it off again.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Toby Allen
  • 10,997
  • 11
  • 73
  • 124

1 Answers1

5

There is no automated way that I know off

Take a look at how to make sure that the view will have the underlying table changes by using sp_refreshview

What you can do is create the view with SCHEMABINDING, that way nobody can modify the tables without dropping the view first.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124
SQLMenace
  • 132,095
  • 25
  • 206
  • 225