🎴 Flashcard Mode

SQL Server Database Fundamentals

Card1 / 20
Mastered0
Review0
QuestionClick to flip

You want to track date and time of the last write access (INSERT, UPDATE) per row. How can you achieve that?

AnswerClick to flip back
A
Add a DATETIME column to the table and write a trigger that sets its value.
💡 Explanation:

TIMESTAMP columns track row version changes but not actual date/time. A DATETIME column with getdate() default only captures creation time, not updates. UNIQUEIDENTIFIER stores GUIDs, not timestamps. To track every INSERT/UPDATE operation, you need a DATETIME column with a trigger that fires on these events.

Change Mode