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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Cached View

Author  Topic 

DominicWatson
Starting Member

2 Posts

Posted - 2007-09-18 : 09:18:57
Hi there,

I have a view that looks something like:

SELECT * FROM [database2].[dbo].[myTable]

I have added a column to the table, [database2].[dbo].[myTable], but the extra column does not appear in the View. I have dropped the view and rebuilt it to no avail.

Any ideas?

Thanks in advance,

Dom

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2007-09-18 : 09:50:20
You just hit one of the problems with "SELECT *"....view don't get rebuilt automatically.
Best practice is to cdioe like "select col1, col2, col3, col4, etc from mytable"

Try creating a totally new view....then check that the old view name is spelt correct...
Go to Top of Page

DominicWatson
Starting Member

2 Posts

Posted - 2007-09-18 : 14:55:53
Ok, great. Thanks for your help. Problem is we didn't code the db and have had no time to fix a lot of the terrible things that are going on inside it!

And the reason it wasn't refreshing? I was dropping and recreating the view BEFORE running the script that added the extra column - what a muppet am I!

Next time I will edit such views that use SELECT * as you pointed out.

Again, thanks for your help.

Dominic
Go to Top of Page
   

- Advertisement -