June 14, 2004 at 7:12 am
It has been documented that a stored procedure automatically recompiles when:
If any schema changes occur to any of the objects referenced in the stored procedure. This includes adding or dropping rules, defaults, and constraints.
Does this behavior apply to procedures that reference views, where the schema chages occur to the base tables?
What are some ways to ensure procedures are updated in an environment where there are nested views (and little change management).
June 15, 2004 at 12:43 am
the rough way :
- Select 'exec sp_refreshview @viewname = ''' + u.name + '.'+ o.name + ''' ' + char(13) + ' go '
from sysobjects o
inner join sysusers u
on (o.uid = u.uid)
where o.xtype = 'v'
and o.name not like 'sys%'
and u.name <> 'INFORMATION_SCHEMA'
-- and u.name = 'only_this_user'
order by u.name, o.name
- dbcc freeproccache
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply