Every once in a while, you find yourself with a database you have no idea who owns it or when it was last accessed. In addition to running a trace on it, you can run this script to get a quick snapshot of any datetime column entries. What it does is use syscolumns to extract each datetime column that exists, map it to it's approrpriate table, and wrap it in a dynamic SQL statement as SELECT TOP 1 <datetime column> FROM <target table> SORT BY <datetime column> DESC'
It's quick and dirty but gets the job done. It does rely on one MASSIVE assumption however. There has to be a datetime column that gets updated in someway (update or insert). There are some apps that use varchar(8) columns for example to capture dates such as '20100502' and this script will not catch those unfortunately. Also, if the column is not indexed and you have a very large number of rows, this could also be problematic due to the descending sort.
To help resolve this, I've defaulted the commands to print out the statements in case you need to verify against some of the larger tables if there is an index on that column, and cut/paste the results to query analayzer.
[EDIT: Fixed buggy code, included a where clause in the select from #findaccesstimes loop]