Share via

Synapse Serverless SQL Pool

Debbie Edwards 526 Reputation points
2023-10-25T08:39:35.2266667+00:00

Very quick question,

I am trying to find the limits of what I can and can't do with the serverless SQL Pool.

Can you do type 2 uploads in the Serverless SQL Pool?

E.g.

PersonKey PersonID PersonName StartDate EndDate MostRecentFlag

1 244 Sue Smith 2021-01-01 2022-02-23 0

1 244 Sue Jones 2022-02-23 0

And if so are there any good resources that explain how to do it?

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.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Debbie Edwards 526 Reputation points
    2023-10-26T08:04:25.7066667+00:00

    I will have a look at that. I am really struggling with the idea that I usually create Stored procedures to run the data into the SQL DB Tables and with the serverless pool you don't have to.

    But if you can do a merge, it feels like this is definitely something that would do in a Stored Procedure. Which is then run via a pipeline.

    Was this answer helpful?


  2. QuantumCache 20,681 Reputation points Moderator
    2023-10-25T17:26:42.3866667+00:00

    Hello @Debbie Edwards

    Did you try using MERGE statement ?

    MERGE INTO dbo.Person AS target
    USING (VALUES
        (244, 'Sue Jones', '2022-02-23')
    ) AS source (PersonID, PersonName, EndDate)
    ON target.PersonID = source.PersonID
    WHEN MATCHED AND target.MostRecentFlag = 1 THEN
        UPDATE SET target.MostRecentFlag = 0, target.EndDate = source.EndDate
    WHEN NOT MATCHED THEN
        INSERT (PersonID, PersonName, StartDate, EndDate, MostRecentFlag)
        VALUES (source.PersonID, source.PersonName, GETDATE(), source.EndDate, 1);
    

    You can find more information about MERGE statement in the official documentation.

    I hope this helps! Let me know if you have any other questions.

    Was this answer helpful?

    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.