Dropping Cache Bindings

When you drop a cache binding for an object, all pages that are currently in memory are cleared from the cache.

To drop cache bindings, use:
  • sp_unbindcache to unbind a single entity from a cache.

  • sp_unbindcache_all to unbind all objects bound to a cache.

The syntax for sp_unbindcache is:
sp_unbindcache dbname [,[owner.]tablename 
[, indexname | "text only"] ]
This example unbinds the titleidind index on the titles table in the pubs2 database:
sp_unbindcache pubs2, titles, titleidind
To unbind all the objects bound to a cache, use sp_unbindcache_all, giving the cache’s name:
sp_unbindcache_all pubs_cache
Note: You cannot use sp_unbindcache_all if more than eight database objects in eight databases are bound to the cache. You must use sp_unbindcache on individual databases or objects to reduce the number of databases involved to eight or less.