Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 94
  • Last Modified:

script smo triggers

Hello,

I search to exclude specific trigger like MsMerge before generate script
$scrp = new-object ('Microsoft.SqlServer.Management.Smo.Scripter') ("SQLTEST\TEST")
$scrp.Options.DriPrimaryKey=$true
$scrp.Options.Triggers=$true
$scrp.Options.AppendToFile=$true
$scrp.Options.FileName="D:\ddl\triggers_ddl.sql"

Thanks

Regards
0
bibi92
Asked:
bibi92
  • 3
  • 2
1 Solution
 
QlemoC++ DeveloperCommented:
Your choices are either to export everything, then apply a text filter to remove unwanted content, or script each object individually. You can't exclude specific objects from the scripter.

Here I would use a mixed approach: script everything but triggers, then add each trigger to the script.
0
 
bibi92Author Commented:
Thanks. How can I apply a text filter to remove unwanted content?
0
 
QlemoC++ DeveloperCommented:
Why not going with the last suggestion? It is much easier to write up and maintain ...
0
 
bibi92Author Commented:
Maybe more simple.
0
 
bibi92Author Commented:
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now