>How can i script all Triggers and Indexes of my db in a vb procedure? i want to generate a script that drop and recreate my triggers and indexs.
>
>for the Views i can use this command :
>
>TheCommand = TheCommand & test.Database(txtDB.Text).Views(X).Script(SQLDMOScript_Default Or SQLDMOScript_Drops)
>
>But there is no such command for the triggers and indexes.
>
>the command i have for the triggers is :
>
>TheCommand = TheCommand & test.Database(txtDB.Text).Tables(X).Script(SQLDMOScript_Triggers)
I believe you have to script those individually (for each table) with something like:
lOptions1 = SQLDMOScript_Default + SQLDMOScript_Drops
For Each oIndex In oTable.Indexes
TheCommand = oIndex.Script(lOptions1)
Next
..
For Each oTrigger In oTable.Triggers
.. Etc.
HTH