How can I get the activity notes of a workflow directly from the tables in SQL Server?


I need to create a query in SQL Server where I can get the activities of certain workflows including the notes that users assigned to each activity. I have no problem with getting the activities, but I don't know how I can get the notes of those activities.

I have reviewed the TSNOTES, TSNOTES2 and TSNOTES3 tables, and after seeing their content I think that the TSNOTES3 table is the one that contains those notes. Is this the correct table? Or should I look in another table?  If that is the correct table, how can this table be related to the TSWKACTIVI table?

The structure of TSNOTES3 includes the n3TableID, n3TableUri and n3Chunk fields. What do these fields store? What do the values they contain mean?

Thank you.