DDL Triggers in SQL Server – SQL Server Tutorial

DDL Triggers in SQL Server :-

  • It is introduced from sql server 2005.
  • This triggers are created to control DDL operations like create,alter,drop.

Syntax :–  create trigger <name>

                        On database

                    After create ,alter,drop

                  As

                 Begin

Statements

               End

Example  :-   Create trigger trg10

                        On database

                         After create create_table

                          As

                           Begin

                          Print ‘table is created’

                                    End.

                                      ↓

              Insert      table xyz(x int)

                                      ↓

                   Table is created

How many instead of insert trigger can be created on a table ?

Answer:- one

Drop trigger trg1 

Leave a Reply

Your email address will not be published. Required fields are marked *