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 |
JsonTerre1
Starting Member
9 Posts |
Posted - 2010-04-14 : 18:00:45
|
I have a data tree structure as such:--Parent 1----Child 1------Sub Child 1------Sub Child 2----Child 2------Sub Child 1------Sub Child 2------Sub Child 3--Parent 2----Child 1------Sub Child 1----Child 2------Sub Child 1------Sub Child 2---------Sub Sub Child 1------Sub Child 3------Sub Child 4------Sub Child 5The admin can create a record that associates to these records. When they do that I need to store a snapshot of that associate as it was when they saved it. In case someone edited the tree and changed names or other values. When the admin goes back in they need to be able to edit this record. I need to do 2 things. Allow them to see the snopshot association that was originally created and be able to edit it. If they edit it I need to be able to see the new changed data as well. How would I accomplish this?jason |
|
DBA in the making
Aged Yak Warrior
638 Posts |
Posted - 2010-04-14 : 18:59:48
|
What does the table look like?------------------------------------------------------------------------------------Any and all code contained within this post comes with a 100% money back guarantee. |
|
|
JsonTerre1
Starting Member
9 Posts |
Posted - 2010-04-15 : 08:29:24
|
There are 3 tables. Topics-- TopicID-- Title-- DateCreated-- DateDeletedCategories-- CategoryID-- TopicID-- ParentCategoryID-- Title-- DateCreated-- DateDeletedActivities-- ActivityID-- CategoryID-- ParentActivityID-- Title-- DateCreated-- DateDeletedThanks for looking into this. jquote: Originally posted by DBA in the making What does the table look like?------------------------------------------------------------------------------------Any and all code contained within this post comes with a 100% money back guarantee.
|
|
|
DBA in the making
Aged Yak Warrior
638 Posts |
Posted - 2010-04-15 : 10:15:47
|
One solution would be to have a separate copy of each table. An insert trigger on the original table could be used to insert records into the copy. An update and delete trigger could be used on the copy table, which would raise an error. This way, the copy table would only allow inserts, and not updates/deletes. For any record int he original tables, there's be one in the copy, that would always be in the same state as the original was when it was inserted.------------------------------------------------------------------------------------Any and all code contained within this post comes with a 100% money back guarantee. |
|
|
JsonTerre1
Starting Member
9 Posts |
Posted - 2010-04-15 : 11:05:10
|
Thanks.quote: Originally posted by DBA in the making One solution would be to have a separate copy of each table. An insert trigger on the original table could be used to insert records into the copy. An update and delete trigger could be used on the copy table, which would raise an error. This way, the copy table would only allow inserts, and not updates/deletes. For any record int he original tables, there's be one in the copy, that would always be in the same state as the original was when it was inserted.------------------------------------------------------------------------------------Any and all code contained within this post comes with a 100% money back guarantee.
|
|
|
|
|
|