DBA Stackexchange Com Questions 12360 What Is The Optimal Wa
DBA Stackexchange Com Questions 12360 What Is The Optimal Wa
_
Database Administrators Stack Here's how it works:
Exchange is a question and answer site
for database professionals who wish to
improve their database skills and learn
from others in the community. Join them;
it only takes a minute:
Anybody can ask Anybody can The best answers are voted
a question answer up and rise to the top
Sign up
What is the optimal way to design an approval queue and audit trail for entities in SQL Server 2008
R2?
Simplified Explanation: I have three main tables: customer, phone, and customer_phone to
Related
resolve the many-to-many. I need to ensure that only admins can insert/update these tables without
approval. Everyone else needs to have their stuff go into an approval queue so admins can 5 Is there a non-DDL way to preserve back-
5 approve it. The admin needs to see the current value(s) and the proposed changes before references when staging data into production?
approving/denying. The system should log who submitted the information, and who approved it
5 Which is quicker: Select of existing row vs
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
(when applicable) in an audit trail, as well as anyone who modified it. The current approach Update where no row exists?
employed has three tables for every entity: 1 Why is replication attempting to distribute
NULL values into Identity columns
1
1. Main entity table
0 Create an Audit trail on SQL Server 2008 to
2. Holding table for unapproved records trace all privilege users
3. Audit log table for each entity 1 Normalization: Should common columns of two
tables be pulled out into a third table?
I think there should be some kind of simpler solution to this. The current system has problems
when: 2 Datawarehouse - Dimension, Fact, or
Degenerative dimension
An admin tries to approve an entity before the main entity is approved that it is linked to
0 Table design for optimum performance
The record already exists in the database but linking it to another record needs to be approved
1 self referencing tables with SQL and entity
This seems like a less-than-optimal solution to me. Is there a better way? framework
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
[Approved] [char](1) NOT NULL, --Y/N How is the message "Unsupported CPU installed"
PRIMARY KEY CLUSTERED ([Phone_ID] ASC) displayed?
addition to the above tables: Should I use the real name or attempt to describe?
CREATE TABLE [dbo].[customer_holding]( When did the phrase "above your paygrade" come
[Customer_ID] [int] NOT NULL, into use?
[Customer_Name] [varchar](255) NOT NULL, display STDOUTs before STDERR?
[Standard_User_ID] [int] NOT NULL, --who added record
PRIMARY KEY CLUSTERED ([Customer_ID] ASC) What feature film had a giant metal military statue
which moved, in front of a building?
CREATE TABLE [dbo].[phone_holding](
How powerful a microscope could my
[Phone_ID] [int] NOT NULL,
pyromancers make?
[Phone_Number] [int] NOT NULL,
[Standard_User_ID] [int] NOT NULL, --who added record Gigabit USB ethernet running at 100mb/s
PRIMARY KEY CLUSTERED ([Phone_ID] ASC)
Why would an army train living soldiers when
manufacturing robots is easier
Programatically standard users' submissions go to the holding table until an admin approves them.
But then I also need an audit log for the user who submitted the original record plus who approved Does ETH and ETC uses the same network ID?
the record and updates to it. The current system accomplishes this with a third auditing table for Write numbers as a difference of Nth powers
each record:
Does Ubuntu 17.10 break the BIOS?
CREATE TABLE [dbo].[customer_audit](
Do I add negative ability scores to skills?
[Customer_ID] [int] NOT NULL,
[User_ID] [int] NULL, Why isn't stripping wires by burning with a lighter a
[When_Approved] [datetime] NOT NULL, more common practice?
[Approved] [char](1) NOT NULL, --Y/N
PRIMARY KEY CLUSTERED ([Customer_ID] ASC) Are these chords the same?
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
[Action_Performed] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED ([Phone_ID] ASC)
Essentially every entity table has a holding table and an audit table for actions associated with that
entity. This seems redundant and problematic to me, although the current system does mostly work
using this design. I think there should be some kind of simpler solution to this. The current system
has problems when:
1. An admin tries to approve the phone before the customer is approved that it is linked to
2. The phone number already exists in the database but linking it to another customer needs to
be approved
It seems that these problems could be resolved through better design. What could be done better?
Three tables for every entity seems redundant to me, is there a better way? Thanks,
sql-server-2008 best-practices
add a comment
You could greatly simplify this by adding a few fields to your existing tables.
Add:
5 ChangeDate - smalldatetime that indicates when a record was added
Active - BIT
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
You keep all your old records, so an update is really just a new row followed by changing the
ACTIVE bit to off for the old record and on for the new one. Your audit trail is built into your data.
The views that you use to expose the data can filter on the ACTIVE bit so no unapproved changes
are sent out. It will also assist in conflict resolution since EVERY proposed change has a row. If two
users propose a change the admin can choose one to accept, or make a new entry consolidating
them.
Yes, but what about maintaining a historical record of who originally created the record and all updates since?
Also, what about when someone edits an existing record and the changes are not yet approved? I want the
original approved record to continue showing until the changes are approved by an admin. – Dan Feb 6 '12
at 21:37
Every update is it's own row. So the MIN(created) for a record will be the "original" – JNK ♦ Feb 6 '12 at
21:38
But how will all the other items linked to it remain linked once the update is approved? The links are all
maintained in separate tables, and there are actually A LOT of linking tables. Customer can be linked to one or
many phones, addresses, orders, etc.? Pardon my questions, just trying to figure this out. Would I have to
programatically update the links in all those tables every time an update is applied? Seems like a lot of
opportunity for errors. – Dan Feb 6 '12 at 21:44
Or do updates get written to the original record, and then the temp update record gets deleted? – Dan Feb 6
'12 at 21:45
It'll depend on how you want to set it up. Come to chat: chat.stackexchange.com/rooms/179/the-heap – JNK ♦
Feb 6 '12 at 21:46
Your Answer
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Sign up or log in Post as a guest
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged sql-server-2008 best-practices or ask
your own question.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
question feed
DATABASE ADMINISTRATORS
Tour
Help
Chat
Contact
Feedback
Mobile
COMPANY
Stack Overflow
Stack Overflow Business
Developer Jobs
About
Press
Legal
Privacy Policy
Technology
Life / Arts
Culture / Recreation
Science
Other
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD