Unable to import bacpac file into Azure due to incompatible newsequentialid () function

I am trying to import a bacpac file / data-level application that was created from a local SQL database and I encountered the following error:

Error during service operation. Failed to import package. SQL0 Warning: A project that defines SQL Server 2012 as a target platform may encounter compatibility issues with SQL Azure. SQL72014 Error: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 The "newsequentialid" built-in function is not supported in this version of SQL Server. SQL72045 error: Script runtime error.

How can I fix or get around this error?

+4
source share
1 answer

Yes, Azure only supports it newid(), because apaprently newsequentialid()is machine dependent. It is clear how I feel, but what a pain!

You can get around this with this procedure:

  • Rename the BACPAC file to a zip file.
  • Open the model.xml file inside zip
  • Replace instances newsequentialid()withnewid()
  • Save the modified file and copy it back to zip.

You basically do this, except for the checksum in Origin.xml, which will fail because you are monkey with the contents of the file.

You need to recalculate the checksum; I did it using PowerShell

Get-FileHash '.\model.xml' -Algorithm SHA256

Then open Origin.xml and replace the hash in the checksum section.

Copy the modified Origin.xml back to zip and rename the file back to .bacpac. Now it will be possible to import without problems.

+4

All Articles