We help IT Professionals succeed at work.

Better way to handle 'auditing' columns such as created_by, created_dt, last_updated_by, last_updated_dt

Jim Horn
Jim Horn asked
on
263 Views
Last Modified: 2015-05-24
Hi guys

In a previous question I made the below comment, which resulted in feedback that there are better ways to handle these values, to include splitting them into a separate table.

As a general rule any table I design that has data entry, I'll add four 'auditing' columns to it that populate via INSERT and UPDATE triggers:
  created_dt  -  datetime - of the entry
  created_by_id -  varchar(30) - SUSER_NAME() of the person creating it
  last_updated_dt  -  datetime - of any insert-update
  last_updated_by_id - varchar(30) - SUSER_NAME() of the person updating it.

Points for advice on a better way to handle this.

Thanks.
Jim
Comment
Watch Question

AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
Have you tried CDC feature yet ?
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Author

Commented:
No.  Have you implemented CDC, and if so how did you do it, and what were the benefits?
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Scott PletcherSenior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
IT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.