We have a problem with the fact that our table schema is not synchronized with our view schema. I would like to know how I can have a stored procedure (for Sql Server) that gets all the views in the database and executes each of them with select *
Here is what I introduced (pseudo):
Declare x
Set x = Select an object from sysobjects, where object = view
view foreach in x
sp_execute 'select * from view'
Then we could get an automated test that calls it every night. A SqlException indicates that something is out of sync.
source
share