1

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?

rs.
  • 25,567
  • 12
  • 63
  • 89

2 Answers2

2

You can simply call sp_refreshsqlmodule or sp_refreshview on non-schemabound views.

Also, this answer

Community
  • 1
  • 1
Cade Roux
  • 85,870
  • 40
  • 177
  • 264
1

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 :)

Andomar
  • 225,110
  • 44
  • 364
  • 390