I installed VS 2022 last night and this is still an issue for me.
Azure Data Warehouse function has problem when we create dacpac file in Visual studio 2019
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?
7 answers
Sort by: Most helpful
-
-
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.
-
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]
-
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!
-
Susanne Zaunmayr 1 Reputation point
2021-10-18T06:57:26.353+00:00 Change Build Action to Compile