Apart from adding a trigger as mentioned by Alex K et all., you could also add a RowVersion column. This data type was previously called TimeStamp, but unfortunately the name is misleading.
This will give you the UpdatedOn smalldatetime timestamp, but not the UpdatedBy information.
If you want to convert the RowVersion colunm into a Date & Time format, you need to do a bit of work;
1. Create a table "UpdateTimeStamp" with three columns
(CreatedDate Smalldatetime, NewRowVersion, OldRowVersion) like this:
Create Table dbo.UpdateTimeStamp(
OldRowVersion binary(8),
CreatedDate DateTime constraint DF_UpdateTimeStamp_TimeStamp Default getdate(),
NewRowVersion ROWVERSION CONSTRAINT PKUpdateTimeStamp PRIMARY KEY CLUSTERED
)
Insert the first row manually
Insert into dbo.UpdateTimeStamp(OldRowVersion, CreatedDate) VALUES (0x0000000000000000, '2000-01-01')
2. Create a SQL Agent job
Which inserts one row in the table every one minute.
Make step 1 run this code:
Insert into dbo.UpdateTimeStamp(OldRowVersion) SELECT TOP (1) NewRowVersion FROM dbo.UpdateTimeStamp ORDER BY NewRowVersion DESC
Set the schedule to run every 1 minute.
3. Join
Join the UpdateTimeStamp table to your table with a between join claus like this:
SELECT top 10000 mt.*, uts.CreatedDate AS ModifiedDate FROM dim.MyTable MT
LEFT JOIN dbo.UpdateTimeStamp uts ON MT.DT1RowVersion > OldRowVersion AND MT.DT1RowVersion <= NewRowVersion
ORDER BY uts.CreatedDate
HIH.
updatedbyvalue can be determined).