Run tool create_trigger

Back

Description

creates a trigger sql to be run in a dbmaintain routine. It deletes the trigger if already exist and create a new one.

example of routine:
CREATE TRIGGER [dbo].[After_Update_Contract_Update_UserName]
ON [dbo].[Contract]
For UPDATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.

SET NOCOUNT ON;
IF ( UPDATE (UserOSID) )
begin
update contract
set UserOSName = FullName
from inserted I, UserInfo U , deleted D
where Contract.ContractID = I.ContractID
and U.UserInfoID = I.UserOSID
end

SET NOCOUNT OFF;
END

Category: SQL

Author: edilio

Please, enter params:

Result