Sybase Column/Row Tracking

nmiller61 used Ask the Experts™
I have a Sybase Anywhere 16 database. I was wondering if there was anyway of see who or when a row or column was last changed. I am thinking there is not but I am not that familiar with Sybase.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Principal Consultant
Most Valuable Expert 2012
Yes, you have two ways you could do this.

SQL Anywhere has database auditing features that can help you get the information you need.

It won't directly report on last time a row or column was updated, but you can configure it to capture information such as all operations requiring permission. You could then extract this data and parse it to arrive at what you want.

Another way which is much easier to get the desired information, but probably more intrusive on database operations, is to add triggers to the tables you want this information for. The trigger could then update either the same table or a different table with a datetime and username for when the data/column was last written to for that table.

If you used an INSERT you'll have a history of when data is changing. This will get very large very quickly. If all you care about is "last updated" then you could use INSERT ... ON EXISTING UPDATE, which inserts if the row doesn't exist, and updates if it does, ensuring you'd only have one row per value. This last usage needs careful attention to primary keys to work correctly.


Thank you that helped a lot.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial