Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last table update date: SQL 2008R2 1

Status
Not open for further replies.

Goofus828

Programmer
Nov 9, 2005
127
US
SQL 2008R2
I'm very new to this so excuse my lack of knowledge.
I'm trying to see when all the table were last updated.

I run this.

use AccountOperations
select object_name([object_id]), last_user_seek, last_user_scan, last_user_lookup, Last_user_update
from sys.dm_db_index_usage_stats
where database_id = db_id( 'AccountOperations' )
go

and I get this
Invalid object name 'sys.dm_db_index_usage_stats'.

Thanks!
 
What do you get when you run this code?

Code:
SELECT  compatibility_level
FROM    sys.databases 
WHERE   name = 'AccountOperations';



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Also... please run this and report back with the output.

Code:
Select @@Version


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I get Invalid Object name sys.database
and
I get Microsoft SQL Server 2000 - 8.00.2305
 
In your original post, you mentioned SQL Server 2008 R2. You may be running Sql Server Management Studio 2008 R2, but your database is most certainly sql 2000. You cannot use sys.dm_db_index_usage_stats with SQL 2000. This was introduced in SQL 2005.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
That makes sense George.

This is an old legacy Database.

That answers my question. Thank you so much!
Josh
 
You're welcome.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top