Skip to content

Export/extract validation error with ISJSON #375

@zijchen

Description

@zijchen
  • SqlPackage or DacFx Version: 162.1.167
  • .NET Framework (Windows-only) or .NET Core: both
  • Environment (local platform and source/target platforms): SQL 2022

Steps to Reproduce:

  1. Create a database with following schema in SQL 2022:
CREATE TABLE tb_json([htmlMetadata] NVARCHAR(MAX))

ALTER TABLE tb_json
ADD CONSTRAINT json_constraint
CHECK ([htmlMetadata] IS NULL OR isjson([htmlMetadata],OBJECT)>0);
  1. Export will fail with this error

*** Error extracting database:Validation of the schema model for data package failed.
Error SQL71501: Error validating element [dbo].[json_constraint]: SqlCheckConstraint: [dbo].[json_constraint] has an unresolved reference to object [dbo].[tb_json].[OBJECT].

DacFx is not understanding the OBJECT keyword in the ISJSON function, thinking it's a column reference.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions