DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

Export fails with error - SQL71623: Model translation is not allowed because the model contains 1 errors

Open zijchen opened this issue 3 years ago • 2 comments

Export fails when stored procedure contains DDL that references a user-defined function. Workaround is to use SqlPackage Extract action with /p:ExtractAllTableData=true.

  • SqlPackage or DacFx Version: 15.0.5282.3
  • .NET Framework (Windows-only) or .NET Core: .NET Core
  • Environment (local platform and source/target platforms): SQL 2019 & Azure

Steps to Reproduce:

  1. Create database with following schema
CREATE FUNCTION [dbo].[Function1]()
RETURNS INT
AS
BEGIN

RETURN 1
    
END
GO

CREATE TABLE [dbo].[Table1](
	[DateCol] [date] NOT NULL,
	[FuncCol] [int] NOT NULL DEFAULT (CONVERT(INT, [dbo].[Function1]())),
) ON [PRIMARY]
GO

CREATE PROCEDURE [dbo].[Procedure1]
AS
BEGIN
	
	CREATE TABLE [dbo].Table1(
		[DateCol] [date] NOT NULL,
		[FuncCol] [int] NOT NULL DEFAULT (CONVERT(INT, [dbo].[Function1]())),
	);

END
GO
  1. Export will fail with following error: image

zijchen avatar Nov 15 '21 18:11 zijchen

@zijchen didn't you already fix this?

llali avatar Mar 21 '22 15:03 llali

@llali no I recall working on this and verifying that it's reproducible, but don't think a fix was implemented yet.

zijchen avatar Mar 21 '22 19:03 zijchen