CREATE TRIGGER Hedge_CodePassword_DateUser_Change
ON [Hedge_CodePassword]
FOR update
AS
--update [Hedge_CodePassword] set TimeStamp = getdate(), CreateUserID = user_name()
UPDATE [Hedge_CodePassword]
set TimeStamp = getdate(), CreateUserID = user_name()
from [Hedge_CodePassword], inserted
where inserted.UserID = [Hedge_CodePassword].UserID
What would be the proper error handling that I would need here? Also I have both updates that work. I commented the one out. Which one is better? Is there a way to do to use a variable that implies the current table or does someone have a tsql script that can place this code into each table in a database? Any help would be greatly appreciated. Thanks
ON [Hedge_CodePassword]
FOR update
AS
--update [Hedge_CodePassword] set TimeStamp = getdate(), CreateUserID = user_name()
UPDATE [Hedge_CodePassword]
set TimeStamp = getdate(), CreateUserID = user_name()
from [Hedge_CodePassword], inserted
where inserted.UserID = [Hedge_CodePassword].UserID
What would be the proper error handling that I would need here? Also I have both updates that work. I commented the one out. Which one is better? Is there a way to do to use a variable that implies the current table or does someone have a tsql script that can place this code into each table in a database? Any help would be greatly appreciated. Thanks