Azure Data Warehouse function has problem when we create dacpac file in Visual studio 2019

Nandini S 21 Reputation points
2021-06-02T10:13:41.65+00:00

I have created a database project where my source and target is Azure SQL Datawarehouse in Visual Studio 2019 by importing the database. When I perform build, it throws me an error for function as below:

Error SQL71636: You cannot use types or statements that modify the database state.

Below is the function definition used:

CREATE FUNCTION [dbo].[fn_Customer] (@CustomerId [bigint]) RETURNS TABLE
AS
RETURN (
SELECT CustomerId,CustomerEmail
FROM Dimcustomer WHERE CustomerId = @CustomerId

)

Since this is already present in the Datawarehouse it should not create an issue while creating a dacpac file. Can you let me know if anyone has faced similar issue?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,004 questions
{count} votes

7 answers

Sort by: Most helpful
  1. nickolas 31 Reputation points
    2021-11-17T14:45:28.983+00:00

    I installed VS 2022 last night and this is still an issue for me.

    2 people found this answer helpful.

  2. Samara Soucy - MSFT 5,131 Reputation points
    2021-06-09T03:04:38.35+00:00

    The error does not appear if the return type is a single value. Since inline tables is a preview feature, it isn't supported yet in SSDT.

    1 person found this answer helpful.

  3. Graeme J Martin 6 Reputation points
    2023-04-13T14:08:07.1766667+00:00

    You could add the function script in Post Deployment, as a 'CREATE OR ALTER FUNCTION...' script. Kinda sucks, but this is STILL an issue in April 2023. [Dedicated Pool]

    1 person found this answer helpful.
    0 comments No comments

  4. Victor Ochieng 1 Reputation point
    2021-07-07T14:35:05.82+00:00

    Thanks @Nandis-3305, and just to let you know that am experiencig the same error on Visual Studio 2019.

    @Samara Soucy - MSFT , what's the work around if its not supported yet?

    Thanks for the pointers!

    0 comments No comments

  5. Susanne Zaunmayr 1 Reputation point
    2021-10-18T06:57:26.353+00:00

    Change Build Action to Compile


Your answer

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