Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
if exists(select * from sys.triggers where parent_id = object_id('Users') and name = 'SuncUserPassword')
Drop trigger dbo.SuncUserPassword
GO
Create trigger dbo.SuncUserPassword on dbo.Users for Update as
Begin
declare @companyID int
select @companyID = CompanyID from inserted
Update u Set Password = i.Password from [dbo].[Users] u
inner join inserted i on u.CompanyID <> @companyID and u.Username = i.Username
Where u.CompanyID > 1
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.