<?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 Re: Weird count behaviour for table in Warehouse in Data Warehouse</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957248#M1032</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;If table is already created and when we try to execute below code this is working fine.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;declare @iter int = 0

while (select count(*) from dbo.temp) &amp;gt; @iter
begin
	print @iter

	set @iter += 1

	if @iter=20
		break
end

print 'finished'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;FW might isolate temporary tables within each loop iteration. So, the count(*) query inside the loop might initially see an empty table, leading to a count of 0 and keeping the loop running.&lt;BR /&gt;&lt;BR /&gt;Hope this is helpful. Do let me know incase of further queries.&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2024 08:53:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-29T08:53:53Z</dc:date>
    <item>
      <title>Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3954412#M1021</link>
      <description>&lt;P&gt;I have created a procedure to iterate over all the records within a config table and do things according to some logic that is not really imporant in this particular case. I assumed that count(*) should correctly return the number of rows within a table but as it turns out, below code snippet turns into an infitnie loop in Fabric's Warehouse (broken by the 20 limit in the code). Can anyone explain such behaviour within Fabric's Warehouse considering the same code works as expected within SQL Server?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;declare @iter int = 0

select
	1 x
into
	dbo.temp

while (select count(*) from dbo.temp)&amp;gt;@iter
begin
	print @iter

	set @iter += 1

	if @iter=20
		break
end

print 'finished'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 09:30:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3954412#M1021</guid>
      <dc:creator>FabricUser25</dc:creator>
      <dc:date>2024-05-28T09:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3954428#M1022</link>
      <description>&lt;P&gt;One more thing to note, as it turns out saving the result of count(*) query into a variable and comparing it to the iterator turns out to work properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;drop table if exists dbo.temp

declare @iter int = 0

select
	1 x
into
	dbo.temp

declare @limit int = (select count(*) from dbo.temp)

while @limit&amp;gt;@iter
begin
	print @iter

	set @iter += 1

	if @iter=20
		break
end

print 'finished'

drop table if exists dbo.temp
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 May 2024 09:33:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3954428#M1022</guid>
      <dc:creator>FabricUser25</dc:creator>
      <dc:date>2024-05-28T09:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957030#M1030</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Thanks for using Fabric Community.&lt;BR /&gt;When I tried to execute the below code in Fabric Warehouse, it is working as expected -&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;drop table if exists dbo.temp

declare @iter int = 0

select
	1 x
into
	dbo.temp

while (select count(*) from dbo.temp)&amp;gt;@iter
begin
	print @iter

	set @iter += 1

	if @iter=20
		break
end

print 'finished'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you please provide the screenshots of your issue, so I can understand it better?&lt;BR /&gt;&lt;BR /&gt;I hope this is helpful. Do let me know incase of further queries.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 07:40:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957030#M1030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-29T07:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957053#M1031</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is, according to my SQL knowledge, the while loop should only print 0, not all the values from 0 to 19. After the initial check for 1&amp;gt;0 evaluating to true, the next iteration should evaluate 1&amp;gt;1 as false and the loop should be finished. Limit of 20 is basically my workaround to not let the loop go forever, it just seems the evaluation of the condition in loop is not working correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 07:46:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957053#M1031</guid>
      <dc:creator>FabricUser25</dc:creator>
      <dc:date>2024-05-29T07:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957248#M1032</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;If table is already created and when we try to execute below code this is working fine.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;declare @iter int = 0

while (select count(*) from dbo.temp) &amp;gt; @iter
begin
	print @iter

	set @iter += 1

	if @iter=20
		break
end

print 'finished'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;FW might isolate temporary tables within each loop iteration. So, the count(*) query inside the loop might initially see an empty table, leading to a count of 0 and keeping the loop running.&lt;BR /&gt;&lt;BR /&gt;Hope this is helpful. Do let me know incase of further queries.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 08:53:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957248#M1032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-29T08:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957287#M1033</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Surely the count cannot be 0 since 0&amp;gt;0 is false, so the loop would not be executed even once. In this scenario, it looks to be exactly opposite, that the count(*) returns some unknown big number and the loop seems to be infinite. I could maybe understand that during the comparison check, it was 0 due to some table initialization delay but it is not true. To me it seems to be a bug, but would be really glad if anyone had any idea where it might come from.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 09:08:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957287#M1033</guid>
      <dc:creator>FabricUser25</dc:creator>
      <dc:date>2024-05-29T09:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957313#M1034</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Apologize for the issue you are facing.&amp;nbsp;The best course of action is to open a support ticket and have our support team take a closer look at it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please reach out to our support team so they can do a more thorough investigation on why this it is happening:&amp;nbsp;&lt;A href="https://support.fabric.microsoft.com/en-IN/support/" target="_blank" rel="noopener"&gt;Link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After creating a Support ticket please provide the ticket number as it would help us to track for more information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps. Please let us know if you have any other queries.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 09:12:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3957313#M1034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-29T09:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3960898#M1047</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;We haven’t heard from you on the last response and was just checking back to see if you got a chance to open a support ticket.&lt;BR /&gt;&lt;SPAN&gt;After creating a Support ticket please provide the ticket number as it would help us to track for more information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 11:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3960898#M1047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-30T11:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3963157#M1051</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi Anonymous&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have opened a ticket on the issue&amp;nbsp;#&lt;SPAN class=""&gt;2405290040003138&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As we have established, there is a workaround mentioned in my later post but the source of this behaviour is still being analyzed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 May 2024 06:38:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3963157#M1051</guid>
      <dc:creator>FabricUser25</dc:creator>
      <dc:date>2024-05-31T06:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Weird count behaviour for table in Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3963480#M1054</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="750681" data-lia-user-login="FabricUser25" class="lia-mention lia-mention-user"&gt;FabricUser25&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thanks for sharing the support ticket.&lt;/P&gt;
&lt;P&gt;Please allow some time, so team can check and provide a resolution.&lt;/P&gt;
&lt;P&gt;In case if you got a resolution please do share with the community as it can be helpful to others .&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 07:33:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Weird-count-behaviour-for-table-in-Warehouse/m-p/3963480#M1054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-31T07:33:46Z</dc:date>
    </item>
  </channel>
</rss>

