Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
DaSaint
Starting Member
9 Posts |
Posted - 2002-03-15 : 14:43:58
|
Hi,I'm using SQL Server 7 and I have a View with a query on different tables. When I change the structure of one of those tables, the view don't follow those changes I've made.Like if my view is "Select * from XYZ" and I add a field to the table XYZ, I need to go in the SQL Enterprise manager and make Apply on the view or I need to Drop and ReCreate the view.Why ? And how can I fix this ? Because I don't want to run a script on my customer Server avery time I make a change on the tables structure...Thank You,DaSaintwebmaster@obscuresun.com |
|
Jay99
468 Posts |
Posted - 2002-03-15 : 14:53:19
|
sp_refreshviewJayEDIT: you still gotta run this to update the view metadata, but its pretty simple. I don't think there is a way to 'make the view refresh itself' . . .Edited by - Jay99 on 03/15/2002 14:55:19 |
|
|
DaSaint
Starting Member
9 Posts |
Posted - 2002-03-15 : 15:10:31
|
Jay99,Thanks a lot for the fast answer.I should have though of this,DaSaintwebmaster@obscuresun.com |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-03-15 : 16:26:45
|
I've never tried this but could you put an update trigger on the sysobejcts table (or whatever system table stores the view info), and call sp_refreshview if the view in question was the one updated?A bit overkill maybe......Michael |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-03-15 : 16:30:18
|
quote: I've never tried this but could you put an update trigger on the sysobejcts table
Whether you can or not, Microsoft strongly discourages putting triggers on any system tables.------------------------GENERAL-ly speaking... |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-03-15 : 17:10:47
|
Ahh, well that makes sense.Just tossing out an idea, seeing if it stuck.Michael |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
|
|
|
|