You can create a trigger in SQL server 2008 R2

1

Good I want to create a trigger that when I create a Procedure the trigger take the name of the procedure and the name of the base data used and this is inserted with the 2 names base data used and name of procedure in a table of X basedato Is this possible? Example:

CREATE TRIGGER PROC_INSERTADOS

DECLARE
@Proc_Name varchar (max),
@DataBase_Name varchar (max)

SET  @Proc_Name = (SELECT proc FROM inserted)
SET  @DataBase_Name = (SELECT proc FROM inserted)

INSERT registro_procedure (Proc_Name,DataBase_Name,FECHA)
VALUES
(@Proc_Name,@DataBase_Name,GETDATE)
    
asked by Juan Carlos Villamizar Alvarez 08.09.2018 в 06:57
source

1 answer

0

You can not, all the data is stored in the master database and in a view which you can consult.

select * from master.information_schema.routines 
    
answered by 20.10.2018 в 21:35