SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Design Help


Database Design Help

Author
Message
ahsanzafars
ahsanzafars
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 7
Hello,
I want to design a database in which editing an information requires an approval. and only when the updated information is used when the approver approves it. This means that i have to maintain two copies of data one is the original information( that will be used until the new information is approved) and other is the updated information.
Could anyone please help me on this that how i will be doing this. as i have many tables and i dont want to keep a pending information table for each original table.

Any help in this regard is appreciated.
Carolyn Richardson
Carolyn Richardson
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1918 Visits: 3488
You shouldn't necessarily need 2 tables why not one table with something like

Field Type
Item - Int
Version - Int (So one item can be changed and you record) changes
Content - varchar
EnteredDate - DateTime
ValidTo - DateTime (Used to expire changed content)
Approved - Bit (Yes No, 1 or 0)
ApprovedBy - varchar (who approves)

Facts are stubborn things, but statistics are more pliable - Mark Twain
Carolyn
SQLServerSpecialists
ahsanzafars
ahsanzafars
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 7
Thankyou Carolyn for your abrupt response i really appreciate it, Actually my problem is little complex( may be simpler for you) lets take an example of a table organization. I have almost 40 columns in it. I broke it into two tables Organization 1(containing the 10 columns which are commonly used.) and Organization 2(which contains the other 30 columns which are not commonly used but surely are organization related info.) now when showing to user to edit the information i take the join and display the data. Now applying the versioning concept of yours make it difficult to implement in such scenario for me. Now i have all the tables having the same summary detail concept. Could you please help me in this scenario or suggest a better alternative.
Carolyn Richardson
Carolyn Richardson
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1918 Visits: 3488
Its a bit difficult from your example, looks like you have an un-normalised database. If you continue in this fashion you will be forced to duplicate information all over the place, if this is a database that cannot be redesigned then I can be of no help.

In my senario there would be a one to many relationship with the new table.

Facts are stubborn things, but statistics are more pliable - Mark Twain
Carolyn
SQLServerSpecialists
Steve Jones
Steve Jones
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: Administrators
Points: 65645 Visits: 19118
I think you might need to provide more information on your design.

You could still use Carolyn's version concept, add a version to both tables, copy the data on edit to a new row. Or just update the related rows.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
ahsanzafars
ahsanzafars
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 7
Thanx Carolyn and Steve for your help.
I will be using a modified versioning concept to enter new rows on edit and updating it to the original row when approved. Also i am now longer breaking my table organization into two different tables.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search