Click here to Skip to main content
15,888,590 members
Home / Discussions / Database
   

Database

 
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 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen12-Jul-14 22:57
professionalEddy Vluggen12-Jul-14 22:57 
GeneralRe: How to create an audit table? Pin
jschell14-Jul-14 9:05
jschell14-Jul-14 9:05 
GeneralRe: How to create an audit table? Pin
jschell11-Jul-14 9:11
jschell11-Jul-14 9:11 
GeneralRe: How to create an audit table? Pin
Mycroft Holmes11-Jul-14 14:19
professionalMycroft Holmes11-Jul-14 14:19 
QuestionSQL Server Express Setup Command Line Problem Pin
Amr Muhammed9-Jul-14 11:25
Amr Muhammed9-Jul-14 11:25 
AnswerRe: SQL Server Express Setup Command Line Problem Pin
Bernhard Hiller9-Jul-14 21:11
Bernhard Hiller9-Jul-14 21:11 
GeneralRe: SQL Server Express Setup Command Line Problem Pin
Amr Muhammed11-Jul-14 3:28
Amr Muhammed11-Jul-14 3:28 
QuestionError converting data type varchar to numeric Pin
Maideen Abdul Kader5-Jul-14 19:42
Maideen Abdul Kader5-Jul-14 19:42 
AnswerRe: Error converting data type varchar to numeric Pin
Mycroft Holmes6-Jul-14 13:01
professionalMycroft Holmes6-Jul-14 13:01 
QuestionCan not connect to my database from asp .net application Pin
Stephen Holdorf5-Jul-14 0:15
Stephen Holdorf5-Jul-14 0:15 
AnswerRe: Can not connect to my database from asp .net application Pin
Eddy Vluggen5-Jul-14 1:23
professionalEddy Vluggen5-Jul-14 1:23 

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.