IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_warehouse_operation_update]') AND type = 'TR')
DROP TRIGGER [dbo].[mps_warehouse_operation_update]
GO
CREATE trigger [dbo].[mps_warehouse_operation_update] on [dbo].[mps_warehouse_operation] for update as
begin
    declare
       @maxcard  int,
       @numrows  int,
       @numnull  int,
       @errno    int,
       @errmsg   varchar(255)

    select  @numrows = @@rowcount
    if @numrows = 0
       return

delete mps_warehouse_operation_detail from deleted 
where whopd_whopid = whop_id 

    return

/*  Errors handling  */
error:
    -- raiserror @errno @errmsg
    rollback  transaction
end