Solved

script smo triggers

Posted on 2016-07-29
5
40 Views
Last Modified: 2016-08-12
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
Comment
Question by:bibi92
  • 3
  • 2
5 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
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
 

Author Comment

by:bibi92
Comment Utility
Thanks. How can I apply a text filter to remove unwanted content?
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Why not going with the last suggestion? It is much easier to write up and maintain ...
0
 

Author Comment

by:bibi92
Comment Utility
Maybe more simple.
0
 

Author Closing Comment

by:bibi92
Comment Utility
thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
A procedure for exporting installed hotfix details of remote computers using powershell
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now