sp_refreshview
From: Ray DeCampo (rkdecampo_at_promergent.com)
Date: 07/07/04
- Next message: Steve Kass: "Re: Data Type for durations"
- Previous message: Joe Celko: "Re: 2 Update statements with different results"
- Messages sorted by: [ date ] [ thread ]
Date: 7 Jul 2004 07:56:57 -0700
Hello,
I have encountered what seems to be a bug with the sp_refreshview
procedure. The issue is when one view depends on another, if
sp_refreshview is executed on the independent view, the dependency is
stricken from the metadata.
You can see this behavior for yourself by executing the following:
--- Begin script
USE pubs
GO
CREATE VIEW authors_view AS SELECT au_lname, au_fname FROM authors
GO
CREATE VIEW ref_authors_view AS SELECT au_lname, au_fname FROM
authors_view
GO
SELECT * FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
GO
sp_refreshview 'authors_view'
GO
SELECT * FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
GO
sp_refreshview 'ref_authors_view'
GO
SELECT * FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
GO
--- End script
The results of the first query correctly show the relationship between
the ref_author_view and the author_view. The second query however
does not show this relationship after sp_refreshview was executed on
the authors_view view. The third query shows the meta-data has been
restored.
Has anybody encountered this issue before and how did you handle it?
Note that I am trying to determine the dependencies between views in
an arbitrary unknown database. So it is not an option to execute
sp_refreshview in the "correct" order, since if I knew the correct
order I wouldn't need to execute it at all.
Thanks,
Ray DeCampo
- Next message: Steve Kass: "Re: Data Type for durations"
- Previous message: Joe Celko: "Re: 2 Update statements with different results"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|