Working with Options and PowerShell

Automate and integrate using the SQL comparison API

Working with Options and PowerShell

Postby dbaduck » Wed Oct 10, 2012 5: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.

Posts: 1
Joined: Wed Oct 10, 2012 5:02 am

Postby Brian Donahue » Thu Oct 11, 2012 10: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: 6590
Joined: Mon Aug 23, 2004 9:48 am

Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests