<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514734#M970</link>
    <description>&lt;P&gt;After creating a Pipeline in Data Factory with success where I fetch data via REST API to Azure SQL Database I wanted to see if I could do the same within Microsoft Fabric and use the new (Synapse) Data Warehouse feature within Fabric.&lt;BR /&gt;&lt;BR /&gt;All steps of my original pipeline work until the last step where I call a script which basically removes duplicate rows from the SQL table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I moved this to Fabric like so&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The error I receive from Fabric is on the last step:&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;The query processor could not produce a query plan because the target DML table is not hash partitioned.&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I know why this is happening, technically, but we can't, as is, add hashing to the SQL tables "stored in Fabric"&lt;BR /&gt;&lt;BR /&gt;I've tried running scripts and stored procedures but with and I've also created another table as an anchor to replicate the hashing method no luck so therefor I ask the community for advice.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;How do you remove duplicate rows in (Synapse) Data Warehouse within Fabric?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2023 15:19:08 GMT</pubDate>
    <dc:creator>Yggdrasill</dc:creator>
    <dc:date>2023-11-03T15:19:08Z</dc:date>
    <item>
      <title>Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514734#M970</link>
      <description>&lt;P&gt;After creating a Pipeline in Data Factory with success where I fetch data via REST API to Azure SQL Database I wanted to see if I could do the same within Microsoft Fabric and use the new (Synapse) Data Warehouse feature within Fabric.&lt;BR /&gt;&lt;BR /&gt;All steps of my original pipeline work until the last step where I call a script which basically removes duplicate rows from the SQL table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I moved this to Fabric like so&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The error I receive from Fabric is on the last step:&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;The query processor could not produce a query plan because the target DML table is not hash partitioned.&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I know why this is happening, technically, but we can't, as is, add hashing to the SQL tables "stored in Fabric"&lt;BR /&gt;&lt;BR /&gt;I've tried running scripts and stored procedures but with and I've also created another table as an anchor to replicate the hashing method no luck so therefor I ask the community for advice.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;How do you remove duplicate rows in (Synapse) Data Warehouse within Fabric?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 15:19:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514734#M970</guid>
      <dc:creator>Yggdrasill</dc:creator>
      <dc:date>2023-11-03T15:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514807#M972</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="53258" data-lia-user-login="Yggdrasill" class="lia-mention lia-mention-user"&gt;Yggdrasill&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for using Fabric Community.&lt;BR /&gt;Can you please explain me how are you removing the duplicate rows? Are you using the DROP command?&lt;BR /&gt;If you are using the DROP command, currently this is not supported in Fabric Warehouse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps. Please let us know if you have any further questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 15:49:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514807#M972</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-03T15:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514940#M974</link>
      <description>&lt;P&gt;I created a stored procedure&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE RemoveDuplicates
AS
BEGIN
    WITH CTE AS (
        SELECT
            *,
            ROW_NUMBER() OVER (PARTITION BY id ORDER BY LastDate DESC) AS RowNum
        FROM
            dbo.MyTable
    )

    DELETE FROM CTE
    WHERE RowNum &amp;gt; 1;
END;




GO
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Nov 2023 17:07:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3514940#M974</guid>
      <dc:creator>Yggdrasill</dc:creator>
      <dc:date>2023-11-03T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3515073#M977</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="53258" data-lia-user-login="Yggdrasill" class="lia-mention lia-mention-user"&gt;Yggdrasill&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;I tried to create a repro with a work around by using the CTAS and the DISTINCT keyword in the stored procedure. I have attached the screenshots for your reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Created a stored procedure removeDuplicates .&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2) The data in Allotment table is as follows:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Executed the stored procedure.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Try using this work around in your stored procedure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps. Please let me know if you have any further questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 18:39:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3515073#M977</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-03T18:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicate values in Fabric Data Warehouse SQL table using Stored Procedure</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3516730#M994</link>
      <description>&lt;P&gt;This SP would work if I want to keep all unique rows but in my case I just want to remove duplicates on my key column [&lt;STRONG&gt;id&lt;/STRONG&gt;] but with the highest value in [&lt;STRONG&gt;LastSyncedDate&lt;/STRONG&gt;]&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Your method will still return duplicate id's&lt;BR /&gt;&lt;BR /&gt;I "solved" this by creating a view in the data warehouse which removes the duplicates and then I just removed the last step of the pipeline and I query the view instead of the table...&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 01:12:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Remove-duplicate-values-in-Fabric-Data-Warehouse-SQL-table-using/m-p/3516730#M994</guid>
      <dc:creator>Yggdrasill</dc:creator>
      <dc:date>2023-11-06T01:12:42Z</dc:date>
    </item>
  </channel>
</rss>

