Data Warehouse
Jan 12 2011
DMBI Tech Tip: Include Audit Columns on all Tables
When I design a database, and local standards permit, I include both a surrogate primary key and audit columns on every table.
A surrogate primary key is a system-generated integer that increments by one with each new row inserted. Most DBMSs make it easy to add surrogate keys. Oracle uses a construct called a Sequence, SQL Server calls its variant an Identity.
The audit columns I like to include are these, shown with their SQL Server datatypes: CreationDatetime (datetime), UpdateDatetime (datetime), CreationUserId (varchar (30)), and UpdateUserid (varchar (30)). Most DBMS’s offer the ability to update columns like these with either default values or triggers.
© 2011 CapTech Ventures, Inc. All Rights Reserved. Legal Notices.