Is it possible to make a trigger after triggering, for example, display the deleted element automatically, that is, after the triggering operation, a query is immediately launched for the example SELECT c_warehouse_id FROM counterparts Which output the deleted element or inserted by the same analogy?

Here is a trigger

 CREATE TRIGGER delete_tiger_test ON WareHouse_DB.dbo.counterparts AFTER DELETE AS BEGIN DECLARE @c_qty as INT, @c_warehouse_id as INT SELECT @c_qty = i.qty FROM deleted i; SELECT @c_warehouse_id = i.warehouse_id FROM deleted i; UPDATE warehouse SET warehouse.income_qty = warehouse.income_qty - @c_qty FROM Counterparts WHERE warehouse.id = @c_warehouse_id PRINT 'TRIGGER [delete_tiger_test] worked' END 

If this can be implemented then how?

  • 2
    Displays where? Do not forget that the trigger works on the database side. And the database has no direct means of communication with the user - Mike
  • @Mike So I need the request to be executed automatically without user intervention - j. Atisto
  • @Mike Like PRINT 'TRIGGER [delete_tiger_test] worked' would just output the query - j. Atisto
  • @Mike Displays - j. Atisto
  • 2
    In which console, the database has no console. The console is only the client who works with the database. A database can only return the result to the client, which he himself must process and display on the console. - Mike

0