Working with Options and PowerShell

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

Working with Options and PowerShell

Postby dbaduck » Wed Oct 10, 2012 6:05 am

When I use the Options.Default things work OK, but I want to add an option IgnoreConstraintNames, but in PowerShell you can specify one or the other, but I need to know how you would do this when executing the CompareWith and want to combine multiple options.

You cannot do [RedGate.SqlCompare.Engine.Options]::Default + [RedGate.SqlCompare.Engine.Options]::IgnoreConstraintNames

because it gives you an error that there is no op_Add for this type of object.

Thanks.
dbaduck
 
Posts: 1
Joined: Wed Oct 10, 2012 6:02 am

Postby Brian Donahue » Thu Oct 11, 2012 11:19 am

I haven't done much powershell myself, but what you need to do is a "bitwise or" operation to append an option to the default options. Powershell defines an operator for this called -bor, so hopefully this works:
([RedGate.SqlCompare.Engine.Options]::Default -bor [RedGate.SqlCompare.Engine.Options]::IgnoreConstraintNames)
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests