Recreating dynamics 365 synapse link tables got the error Msg 16588, Level 16, State 1, Line 305 Virtual or partition columns found in Delta external table.

MrFlinstone 711 Reputation points
2025-10-20T08:10:15.6066667+00:00

I have got synapse link for dynamics 365 setup, entities from dynamics are being synchronised to data lake storage account in Azure, however I am trying to create a curated new database by scripting out the existing datalake database. On one of the tables, after trying to run the script, I get the error when creating the table.

CREATE EXTERNAL TABLE [dbo].[tablename]
(
	[Id] [uniqueidentifier],
	[SinkCreatedOn] [datetime2](7),
	[SinkModifiedOn] [datetime2](7),
	[accountid] [uniqueidentifier],
	[accountleadid] [uniqueidentifier],
	[importsequencenumber] [bigint],
	[leadid] [uniqueidentifier],
	[name] [varchar](400),
	[overriddencreatedon] [datetime2](7),
	[timezoneruleversionnumber] [bigint],
	[utcconversiontimezonecode] [bigint],
	[versionnumber] [bigint],
	[IsDelete] [bit],
	[CreatedOn] [datetime2](7),
	[PartitionId]  AS CAST(filepath(1) AS VARCHAR(20))
)
WITH (DATA_SOURCE = [link],LOCATION = N'tablename_partitioned',FILE_FORMAT = [DELTA])
GO

I got the error below

Msg 16588, Level 16, State 1, Line 305

Virtual or partition columns found in Delta external table.

Azure Data Lake Analytics
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 41,121 Reputation points Volunteer Moderator
    2025-10-20T19:58:37.3166667+00:00

    Hello !

    Thank you for posting on Microsoft Learn Q&A.

    You’re mixing Delta with a virtual or partition column. In serverless SQL, Delta external tables don't allow virtual columns like filepath()/filename() or computed partition columns. That’s exactly what this bit does:

    [PartitionId] AS CAST(filepath(1) AS VARCHAR(20))
    

    If your delta table is partitioned by PartitionId, that column already exists in the delta schema and just declare it as a normal column:

    CREATE EXTERNAL TABLE [dbo].[tablename]
    (
        [Id] UNIQUEIDENTIFIER,
        [SinkCreatedOn] DATETIME2(7),
        [SinkModifiedOn] DATETIME2(7),
        [accountid] UNIQUEIDENTIFIER,
        [accountleadid] UNIQUEIDENTIFIER,
        [importsequencenumber] BIGINT,
        [leadid] UNIQUEIDENTIFIER,
        [name] VARCHAR(400),
        [overriddencreatedon] DATETIME2(7),
        [timezoneruleversionnumber] BIGINT,
        [utcconversiontimezonecode] BIGINT,
        [versionnumber] BIGINT,
        [IsDelete] BIT,
        [CreatedOn] DATETIME2(7),
        [PartitionId] VARCHAR(20)  
    )
    WITH (
        DATA_SOURCE = [link],
        LOCATION = N'tablename_partitioned',  
        FILE_FORMAT = [DELTA]
    );
    

    If you don’t create an external table, you can use a VIEW over OPENROWSET(… FORMAT='DELTA') and this way you can avoid schema drift pain and the virtual column restriction:

    CREATE OR ALTER VIEW dbo.tablename AS

    SELECT *
    FROM OPENROWSET(
        BULK 'tablename_partitioned/',     
        DATA_SOURCE = [link],
        FORMAT = 'DELTA'
    ) AS r;
    

    If you need the folder value, you could add filepath() in a view over parquet/CSV but for delta specifically, virtual columns aren’t supported so you can rely on the real partition column instead.

    If the folder doesn’t have _delta_log, it isn’t Delta then either switch to FILE_FORMAT = PARQUET and you may use filepath():

    CREATE EXTERNAL TABLE dbo.tablename
    (
        ...,
        PartitionId AS CAST(filepath(1) AS VARCHAR(20))
    )
    WITH (
        DATA_SOURCE = [link],
        LOCATION = 'tablename_partitioned',
        FILE_FORMAT = [ParquetFormat]
    );
    

    or convert it properly to delta first.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.