Click here to Skip to main content
15,896,063 members
Home / Discussions / Database
   

Database

 
GeneralRe: OVER (PARTITION BY ORDER BY ) Pin
Ambertje14-Jul-14 22:13
Ambertje14-Jul-14 22:13 
QuestionError: Can't delete row or update row in SQL Server ? Pin
taibc11-Jul-14 18:29
taibc11-Jul-14 18:29 
AnswerRe: Error: Can't delete row or update row in SQL Server ? Pin
Mycroft Holmes11-Jul-14 23:32
professionalMycroft Holmes11-Jul-14 23:32 
GeneralRe: Error: Can't delete row or update row in SQL Server ? Pin
taibc13-Jul-14 20:36
taibc13-Jul-14 20:36 
GeneralRe: Error: Can't delete row or update row in SQL Server ? Pin
Mycroft Holmes13-Jul-14 21:06
professionalMycroft Holmes13-Jul-14 21:06 
AnswerRe: Error: Can't delete row or update row in SQL Server ? Pin
ZurdoDev14-Jul-14 10:14
professionalZurdoDev14-Jul-14 10:14 
QuestionJOIN vs. WHERE Pin
Klaus-Werner Konrad11-Jul-14 9:22
Klaus-Werner Konrad11-Jul-14 9:22 
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 
Do you know if it exist a document or recommendation to create audit table or metadata elements on a database.

I ask this question because I just saw this :

SQL
CREATE TABLE client (
    id char(36)  NOT NULL,
    first_name varchar(255)  NOT NULL,
    last_name varchar(255)  NOT NULL,
    creation_date timestamp  NOT NULL,
    update_date timestamp  NOT NULL,
    CONSTRAINT client_pk PRIMARY KEY (id)
);


I don't like the idea to have metadata like creation_date and update_date in a business oriented table. Actually these two fields exists in all tables of this database.

What if I create a audit table like this:

SQL
CREATE TABLE audit (
    table_name char(32)  NOT NULL,
    fk char(36)  NOT NULL,
    update_date timestamp  NOT NULL
);


I don't need a creation date because the creation date is my first record with table_name and fk in this table. I could add a columns to add insert, update, delete information. With thi table I keep all my update dates and not only the last one.

Is this audit table a god practice ?
Can I also use this audit table to avoid conflict. You know when two users update the same record at the same time. It's possible to use the last update time to warn them there is a conflict.
AnswerRe: How to create an audit table? Pin
Eddy Vluggen10-Jul-14 8:14
professionalEddy Vluggen10-Jul-14 8:14 

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.