Click here to Skip to main content
15,900,110 members
Home / Discussions / Database
   

Database

 
AnswerRe: JOIN vs. WHERE Pin
Mycroft Holmes11-Jul-14 14:24
professionalMycroft Holmes11-Jul-14 14:24 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad12-Jul-14 9:08
Klaus-Werner Konrad12-Jul-14 9:08 
GeneralRe: JOIN vs. WHERE Pin
Mycroft Holmes12-Jul-14 14:13
professionalMycroft Holmes12-Jul-14 14:13 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad13-Jul-14 0:08
Klaus-Werner Konrad13-Jul-14 0:08 
AnswerRe: JOIN vs. WHERE Pin
data modeling guy11-Jul-14 19:53
data modeling guy11-Jul-14 19:53 
GeneralRe: JOIN vs. WHERE Pin
Mycroft Holmes11-Jul-14 23:29
professionalMycroft Holmes11-Jul-14 23:29 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 9:42
professionalJörgen Andersson12-Jul-14 9:42 
AnswerRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 10:25
professionalJörgen Andersson12-Jul-14 10:25 
GeneralRe: JOIN vs. WHERE Pin
Mycroft Holmes12-Jul-14 14:22
professionalMycroft Holmes12-Jul-14 14:22 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 20:44
professionalJörgen Andersson12-Jul-14 20:44 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 20:55
professionalJörgen Andersson12-Jul-14 20:55 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad13-Jul-14 0:35
Klaus-Werner Konrad13-Jul-14 0:35 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson13-Jul-14 1:09
professionalJörgen Andersson13-Jul-14 1:09 
GeneralRe: JOIN vs. WHERE Pin
data modeling guy13-Jul-14 5:57
data modeling guy13-Jul-14 5:57 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad13-Jul-14 1:08
Klaus-Werner Konrad13-Jul-14 1:08 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson13-Jul-14 1:46
professionalJörgen Andersson13-Jul-14 1:46 
QuestionHow to create an audit table? Pin
Bastien Vandamme10-Jul-14 0:30
Bastien Vandamme10-Jul-14 0:30 
AnswerRe: How to create an audit table? Pin
Eddy Vluggen10-Jul-14 8:14
professionalEddy Vluggen10-Jul-14 8:14 
AnswerRe: How to create an audit table? Pin
Mycroft Holmes10-Jul-14 14:15
professionalMycroft Holmes10-Jul-14 14:15 
Personally I don't consider that an audit solution, I say solution because audit is a whole lot of objects. We do a field level audit so we can track any changes to the data. Simply the ID for an inserted record, each field that is changed - only getting the from value and each field from a deleted record.

In theory this allows us to reproduce any action done by the users. Also we do not audit every table as the apps we build are based on other systems so we only track the master table changes.

The audit is initiated by a trigger spit, the ONLY valid use for the dammed things. This is our audit table.

SQL
CREATE TABLE [dbo].[AuditLog](
	[AuditID] [INT] IDENTITY(1,1) NOT NULL,
	[Action] [CHAR](1) NULL,
	[TableName] [VARCHAR](128) NULL,
	[PrimaryKeyField] [VARCHAR](1000) NULL,
	[PrimaryKeyValue] [VARCHAR](1000) NULL,
	[FieldName] [VARCHAR](500) NULL,
	[OldValue] [VARCHAR](1000) NULL,
	[ModifiedDate] [DATETIME] NULL,
	[UserName] [VARCHAR](200) NULL
) ON [PRIMARY]


Every table has a modified and modifiedby field. We also have a table of table names that allows us to run a script and apply/remove triggers from the target tables. As I said theres a whole ecosystem for auditing and it all lives in our model database so it is automatically included in every new database created.

In a vast number of years building LOB apps and some of them transactional I have never been hit by the condition of 2 users editing the same record except in 2 cases, contrived conditions to test the effect and in the early 90s using Microsoft Access in a multi user environment. It is a completed furfy IMNSHO.
Never underestimate the power of human stupidity
RAH

GeneralRe: How to create an audit table? Pin
GuyThiebaut11-Jul-14 2:09
professionalGuyThiebaut11-Jul-14 2:09 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen11-Jul-14 7:28
professionalEddy Vluggen11-Jul-14 7:28 
GeneralRe: How to create an audit table? Pin
jschell11-Jul-14 9:07
jschell11-Jul-14 9:07 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen11-Jul-14 9:44
professionalEddy Vluggen11-Jul-14 9:44 
GeneralRe: How to create an audit table? Pin
Mycroft Holmes11-Jul-14 14:12
professionalMycroft Holmes11-Jul-14 14:12 
GeneralRe: How to create an audit table? Pin
jschell12-Jul-14 10:33
jschell12-Jul-14 10:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.