Guest User

Untitled

a guest
Nov 28th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. if exists(select * from sys.triggers where parent_id = object_id('Users') and name = 'SuncUserPassword')
  2. Drop trigger dbo.SuncUserPassword
  3. GO
  4.  
  5. Create trigger dbo.SuncUserPassword on dbo.Users for Update as
  6. Begin
  7. declare @companyID int
  8. select @companyID = CompanyID from inserted
  9.  
  10. Update u Set Password = i.Password from [dbo].[Users] u
  11. inner join inserted i on u.CompanyID <> @companyID and u.Username = i.Username
  12. Where u.CompanyID > 1
  13. End
Add Comment
Please, Sign In to add comment