Created
March 6, 2019 07:56
-
-
Save ebenito/200aa860b3333e3e1770b4c49362a233 to your computer and use it in GitHub Desktop.
Trigger para capturar usuario y fecha y hora de modificación
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER [dbo].[NombreTrigger_UpdIns] ON [dbo].[NombreTabla] | |
FOR UPDATE, INSERT AS | |
UPDATE NombreTabla | |
SET UserName = coalesce(suser_sname(),'?'), | |
UserDateTime = GETDATE() | |
WHERE id IN (SELECT DISTINCT id FROM Inserted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment