2

Sorry for my english.

I have the following definitions in a visual studio 2017 dacpac project (target platform = SQL SERVER 2016).

CREATE SCHEMA [Demo]
CREATE TYPE Demo.Code FROM NVARCHAR(16) NOT NULL 
CREATE TABLE [Demo].[Gear] (
    [Id] int identity(1,1) primary key, 
    [Name] nvarchar(25) not null, 
    [Code] [Demo].[Code], 
    [rowguid] uniqueidentifier constraint [DF_Gear_rowguid] default (newid()) rowguidcol not null, 
    [ValidStart] DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL,
    [ValidEnd] DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL,
    PERIOD FOR SYSTEM_TIME([ValidStart], [ValidEnd])
)
WITH ( SYSTEM_VERSIONING = ON(HISTORY_TABLE = [Histo].[Gear]) )
GO

After build, I have this error :

SQL71609: System-versioned current and history tables do not have matching schemas. Mismatched column: '[Demo].[Gear].[Code]'.

Without user defined data type, it's okay. Is someone knowing that's the problem ?

S.Viv
  • 21
  • 2
  • 1
    [Known issue](https://stackoverflow.com/a/41004522/4137916) and it has not been fixed even as of today. This code will work fine in SQL Server itself, just not in the project. The workaround is to explicitly define the `Histo.Gear` table in the project as well. – Jeroen Mostert Jul 09 '18 at 10:45
  • 1
    If this is related to SQL server itself. Please report the same issue to Microsoft as well. This will help the community. – Rahul Neekhra Jul 09 '18 at 11:24

0 Answers0