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.
  • 26,707
  • 12
  • 68
  • 90

2 Answers2

2

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

Also, this answer

Community
  • 1
  • 1
Cade Roux
  • 88,164
  • 40
  • 182
  • 265
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
  • 232,371
  • 49
  • 380
  • 404