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
?
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
?
You can simply call sp_refreshsqlmodule or sp_refreshview on non-schemabound views.
Also, this answer
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 :)