Sitecore.Sessions.dacpac database fails to be deployed to Azure SQL


Description

Importing the Sitecore.Sessions.dacpac database into Azure SQL might fail with the following error: 

TITLE: Microsoft SQL Server Management Studio
------------------------------

Could not deploy package.
Warning SQL0: A project which specifies SQL Server 2016 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12.
Error SQL72014: .Net SqlClient Data Provider: Msg 40515, Level 15, State 1, Procedure CreateTables, Line 16 Reference to database and/or server name in 'tempdb.dbo.SessionState' is not supported in this version of SQL Server.
Error SQL72045: Script execution error. The executed script:
CREATE PROCEDURE [CreateTables]
AS
BEGIN
SET NOCOUNT ON;
IF (NOT EXISTS (SELECT 1
FROM [tempdb].[information_schema].[tables]
WHERE ([table_catalog] = 'tempdb')
AND ([table_schema] = 'dbo')
AND ([table_type] = 'BASE TABLE')
AND ([table_name] = 'SessionState')))
BEGIN
CREATE TABLE [tempdb].[dbo].[SessionState] (
[Id] NVARCHAR (88) NOT NULL,
[Application] UNIQUEIDENTIFIER NOT NULL,
[Created] DATETIME DEFAULT GETUTCDATE() NOT NULL,
[Expires] DATETIME NOT NULL,
[LockTimestamp] DATETIME NOT NULL,
[LockCookie] CHAR (32) NOT NULL,
[Timeout] INT NOT NULL,
[Flags] INT DEFAULT 0 NOT NULL,
[Item] IMAG
(Microsoft.SqlServer.Dac)

------------------------------
BUTTONS:

OK
------------------------------

Solution

To resolve the issue download and install the patch compatible with the affected product version found on this page: https://github.com/SitecoreSupport/Sitecore.Support.218401/releases.

To get a solution for other Sitecore XP releases, contact Sitecore Support.