Reputation: 27467
When I query INFORMATION_SCHEMA.VIEWS
it lists all views, but when I query INFORMATION_SCHEMA.VIEW_TABLE_USAGE
it displays only a few views.
How can I rebuild all the views info in INFORMATION_SCHEMA.VIEW_TABLE_USAGE
?
Upvotes: 1
Views: 1051
Reputation: 89741
You can simply call sp_refreshsqlmodule or sp_refreshview on non-schemabound views.
Also, this answer
Upvotes: 2
Reputation: 238296
You can export the entire database as a script (right click database -> Tasks -> Generate Scripts). Running that script in a new database will generate the correct dependencies. You can then pump over the data from the old database. I'd expect that to be a lot of work.
There are commercial tools, like RedGate SQL Dependency Tracker, that make this much easier. They have a free demo, but be warned, you'll grow dependent on those tools quickly :)
Upvotes: 1