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 |
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2003-08-08 : 08:35:57
|
Hi,I want to know my table's last accessed date and time. Do you know any idea for getting this details using SQL-Server or Else?Send me ur valuable reply.Thanks ":-) IT Knowledge is power :-)" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-08-08 : 08:40:55
|
| Unless you've written code to keep track of that type of thing, the best way is to ask your users what time they last accessed the table ... (I know, not the answer you wanted.)Jay White{0} |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-08 : 09:01:06
|
| Use the profiler to log accesses - but this will impact performance.Create triggers to log inserts/updates - but this will impact performance.If all access is via SPs then you can log in the SPs.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-08-08 : 10:27:34
|
quote: Originally posted by Page47 Unless you've written code to keep track of that type of thing, the best way is to ask your users what time they last accessed the table ... (I know, not the answer you wanted.)Jay White{0}
LOLAdd datetime columns to your table that track it.. you'll have change your updates to add an updated_dt = getdate() statement.Or you can just ask your users..they won't lie, and always remeber what they did...Brett8-)SELECT POST=NewId() |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-08 : 10:33:25
|
| >> Add datetime columns to your table that track it.. you'll have change your updates to add an updated_dt = getdate() statement.You could just add a trigger to each table - would impact performance though.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-08-08 : 10:37:14
|
quote: Originally posted by nr >> Add datetime columns to your table that track it.. you'll have change your updates to add an updated_dt = getdate() statement.You could just add a trigger to each table - would impact performance though.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.
To do what? Update the dattime column in the base table, or write to another table to track changes?Also, how much overhead? A lot...haven't workied on high transactional systems in SQL Server to see any impact.Everything I've done to data fires a trigger from base to store all changes in history...haven't see the server blink...Brett8-)SELECT POST=NewId() |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-08 : 10:47:46
|
| Haven't done any comparisons for a long time but a trigger used to prevent direct updates in place and cause about 5 times as much data to be written to the log. Suspect it's better now though.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|