"Include If Not Exist" does not work in v5.0.1

Jul 22, 2014 at 5:28 PM
When I set the "Include If Not Exist" advanced setting to "True", the generated script is missing the expected "IF NOT EXISTS (SELECT * FROM sys.objects ..."
Jul 22, 2014 at 5:35 PM
Edited Jul 22, 2014 at 5:53 PM
I looked at the code and found the following:
            if (_SqlServerSelection.ConnectionContext.DatabaseEngineType == DatabaseEngineType.SqlAzureDatabase)
                scrptr.Options.IncludeIfNotExists = false; // SMO 2014 is broken
                scrptr.Options.IncludeIfNotExists = options.IncludeIfNotExists; // ***
            scrptr.Options.IncludeIfNotExists = options.IncludeIfNotExists; // ***
Looks like 'false' is hardcoded for Sql Azure. I wonder why???
Jul 23, 2014 at 3:26 AM
Hi Jericho,

The quick answer is that SQL Server 2014 SMO has a defect in it when working with SQL DB. SQL DB does not support SQL Server 2014 SMO. So, I had to basically shut that feature off for SQL Server 2014 / SQL DB because SMO crashes with that setting. I don't know if this issue will be fixed or not. So, for now, I have to disable this feature.

I hope this helps. If you want to talk more, we can talk offline.

I Hope this helps,