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 Administration (2000)
 Find when a View was Last Modified

Author  Topic 

mistux
Yak Posting Veteran

90 Posts

Posted - 2006-01-27 : 11:17:27
Is there a way to determin when a view was last edited or modified? I don't mean the create date, but the date that it was changed.

I made some edits to a bunch of views and now I have to undo them, but don't know which I modified, so I thought I could just look at the date, since I made the goof on just one day, but I can't seem to find a "last modified date" anywhere to use.

Michael
For all your DNC needs for your CNC machines. www.mis-group.com

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-01-27 : 13:26:36
This does not exist in SQL Server 2000. It does in SQL Server 2005 though.

Tara Kizer
aka tduggan
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-01-27 : 13:32:32
Dear mistax,

This is one reason you should not change code in Enterprise Manager.

You create scripts that you run and save them in query analyzer.

And I always drop and create objects (even though sometimes it can be a pain).

I would also establish change control procedure so I know what's going on.

Why do you have to undo them? And how would you know what to change them back to?

I suggest this. Restore a copy of the database to a new db name to before you made the changes. Then compare the 2 catalogs.

Good Luck



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

mistux
Yak Posting Veteran

90 Posts

Posted - 2006-01-27 : 16:21:22
quote:
Originally posted by X002548


Why do you have to undo them? And how would you know what to change them back to?


I went into all the views and removed the Top 100 percent (per a suggestion I got) and did not realize that that removed all my sorts! Since I did it all on one day, I knew the dates.

Michael
For all your DNC needs for your CNC machines. www.mis-group.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-01-28 : 02:40:01
[reading more carefully I'm saying the same thing as Brett, but in case it helps I've left it in!)

Restore from an earlier backup (to a temporary database).

Script out the VIEWs that you subsequently changed.

Do the same thing on the "live" database.

Compare the two scripts (using your favourite programmers editing tools).

Merge the stuff that you need from the Old into the New. Run the new, modified, script.

Then put a policy in place, as Brett indicated, to store the scripts of Views, Sprocs, Triggers and DDL changes, as files on disk. Then you need a Version Control system - e.g. SubVersion which is free/OpenSource, and very good.

Kristen
Go to Top of Page
   

- Advertisement -