Solved

script smo triggers

Posted on 2016-07-29
5
53 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 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 41735714
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
ID: 41736793
Thanks. How can I apply a text filter to remove unwanted content?
0
 
LVL 69

Expert Comment

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

Author Comment

by:bibi92
ID: 41737868
Maybe more simple.
0
 

Author Closing Comment

by:bibi92
ID: 41754143
thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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