I have following command which creates trigger in database
command.ExecuteNonQuery();
The trigger is created successfully. But how Can I detect if It has been created while executing command ?
So far I managed to execute separated command that check if trigger allready exists in database, but what I need is to check while it is being created.
string insert = " CREATE TRIGGER TraNag_UpdateInsertOpis ON dbo.TraNag"
+ " FOR INSERT,UPDATE"
+ " AS"
+ " DECLARE @OpisInsert varchar(1024)"
+ " DECLARE @TrnSymbolInsert varchar(40)"
+ " select @TrnSymbolInsert = TrN_Symbol, @OpisInsert = Trn_Opis from inserted "
+ " IF (@TrnSymbolInsert = 'MMW')"
+ " BEGIN"
+ " IF NOT EXISTS("
+ " SELECT Mag_Symbol"
+ " FROM dbo.Magazyny"
+ " WHERE Mag_Symbol like @OpisInsert"
+ " )"
+ " BEGIN"
+ " RAISERROR('Error NOT FOR STACKOVERFLOWWWW !!! : %s', 16, 1, @OpisInsert);"
+ " END END";