views:

76

answers:

2

How do I view previous queries in SQL Server 2000 database

+2  A: 

You can't, unless you were monitoring and logging them via Profiler. Although if you have something like Log Explorer, you can browse the transaction log and see who updated things. This won't show previously-run SQL, though.

CodeByMoonlight
A: 

Based on this post, it looks like using DBCC LOG(database_name) in SQL 2000 will get the transaction log information. Didn't get a chance to try this myself though.

Ron Harlev
But this will only have transaction log data in it. You won't see things like SELECTs (if Brad is interested in those; admittedly, it's hard to guess what he meant by "queries"), and you won't see the actual DML statements used - only the result it had on the data. You will see things like:Current LSN Operation Context Transaction ID00000015:000000ae:0004 LOP_MODIFY_ROW LCX_IAM 0000:00000226Not very useful. On top of that, this information will only be around if there hasn't been a DB or log backup. And if you're being good about those, that should mean not very long at all.
Aaron Bertrand