当行更新/更改时,是否可以使用CurrentDateTime自动更新ModifiedDate?
SELECT [ID]
,[PK]
,[Iteration]
,[Exam01]
,[Exam02]
,[Exam03]
,[Exam04]
,[Exam05]
,[Exam06]
,[Exam07]
,[Exam08]
,[Exam09]
,[Exam10]
,[Exam11]
,[Exam12]
,[Exam13]
,[Exam14]
,[HRGCode]
,[AgeStart]
,[AgeEnd]
,[CreateDate]
,[ModifiedDate] --- Need this to update when the row is Modified!
,[ModifiedBy]
,[Comments]
FROM [CommDB].[dbo].[tblRadiologyNucMedLookup] c
order by ID
答案 0 :(得分:1)
你真的需要一个触发器吗?您可以在与
相同的UPDATE
语句中添加该列
update tblRadiologyNucMedLookup
set Iteration = 10,
[ModifiedDate] = getdate()
where ID = 101;