Author Posts

October 12, 2016 at 7:01 pm

Good afternoon All,

I find myself into a bit of a strange situation.

Basically, I have a PowerShell script which uses SMO to generate DDL scripts for database objects (tables, in my case).
After assigning the various scripter options (among others, was the disable of all object constraints), when I am running the PowerShell script on my Win 7 machine (Powershell Version 4, 64 Bit), I get the desired DDL scripts, where all tables have no constraints whatsoever. Everything looks good!

But when I run the same PowerShell script from a Win Server 2012 machine (same PowerShell version 4, 64 Bit), the generated DDL scripts contain constraints for the source tables. Note that the source tables are identical in both situations.

So far, I double checked that the code is the same and that the version and environment of the PowerShell script is identical in both situations. Note that I am calling the PowerShell scripts via windows batch files (again, identical in both situations).

Nothing else comes to mind on what would I be checking next. Anyone else has encountered anything of the sort?
Any help would be greatly appreciated.

Regards,
Constantin

October 17, 2016 at 1:39 pm

Can you post the script and sample input?