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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Return different data for a record per user

Author  Topic 

palsys
Starting Member

1 Post

Posted - 2014-12-08 : 08:40:01
I am looking to design a new schema and wanted to see if anyone has run into a similar situation and has pointers.

I would like to be able, for several tables in the database, to have multiple versions of a record at the same time tied back to a user.

Each user can have their own 'version' of the record until the record is published, and then the published record becomes the one everyone sees as the main record but they can still edit theirs. They key is I want to keep PKs so they don't change.

For example, the published version:

Table: dbo.Products
ProductId,Name,Description,Status
==========================
1, Car Tire, A round tire for your car,Published


Now I want to have a version that the user edits without creating a new record in dbo.Products


ProductId,Name,Description,Status
==========================
1, Red Car Tire, A red round tire for your car,Edited


Any quick thoughts on this? I'll publish more examples later this morning as I think of them and work through it.

Mar
Starting Member

47 Posts

Posted - 2014-12-09 : 10:26:52
Your example are different, so according to the database they are two separate records. Its like a parent - child relationship. Which one gets created first?

The display of the records does not need to match the way they're logically stored. You can have a parent - child relationship stored in the DB and display them as separate on the screen.
Go to Top of Page
   

- Advertisement -