Using Trigger to Track Who Changed Table data

I think you need to fully read the documentation before you try something.

CREATE TRIGGER TR_UPD_tblUser ON tblUser
FOR UPDATE, delete 
--NOT FOR REPLICATION 
AS
 
BEGIN
  insert into tblAU
([anbrID]
,[intCompanyID]
,[strFirstName]
,[strLastName]
,[strDepartment]
,[strUserID]
,[strPassword]
,[strTitle]
,[strTelephone]
,[strTelephoneExt]
,[strFax]
,[strCellPhone]
,[strEmail]
,[strWebEmail]
,[strUserType]
,[booLocked]
,[booAllowAP]
,[booAllowAR]
,[booAllowIV]
,[booActive]
,[booSuperUser]
,[booQO]
,[intCommodityLevel]
,[booQQLiteUser]
,[booFBA]
,[LandingPage]
,[PasswordExpirationDT]
,[ConsecutiveUnsuccessfulLogins]
,[CreateById]
,[CreateDT]
,[LastEditById]
,[LastEditDT])
select i.[anbrID]
	,i.[intCompanyID]
	,i.[strFirstName]
	,i.[strLastName]
	,i.[strDepartment]
	,i.[strUserID]
	,i.[strPassword]
	,i.[strTitle]
	,i.[strTelephone]
	,i.[strTelephoneExt]
	,i.[strFax]
	,i.[strCellPhone]
	,i.[strEmail]
	,i.[strWebEmail]
	,i.[strUserType]
	,i.[booLocked]
	,i.[booAllowAP]
	,i.[booAllowAR]
	,i.[booAllowIV]
	,i.[booActive]
	,i.[booSuperUser]
	,i.[booQO]
	,i.[intCommodityLevel]
	,i.[booQQLiteUser]
	,i.[booFBA]
	,i.[LandingPage]
	,i.[PasswordExpirationDT]
	,i.[ConsecutiveUnsuccessfulLogins]
	,i.[CreateById]
	,i.[CreateDT]
	,SUSER_SNAME()
	,getDate()

	from  inserted i
END
2 Likes