#StackBounty: #sql-server #azure-sql-database SQL Server logging within Azure

Bounty: 50

I’m looking at an xel file that’s been exported from Microsoft Azure Storage Explorer.

One specific query:

select top 1 dist.Distance...

which should only “affect” one row. Without top 1, the query would never return more than 10 rows.

But the xel file reads that the affected_rows were 210720 for that query.

What does that number represent?

EDIT – Adding full query

declare @Latitude float = 0,@Longitude float = 0

select top 1 dist.Distance, f.id, f.SEOPageTitle, f.SEOMetroCity, f.SEOCity1, f.SEOCity2, f.SEOCity3, f.MetaDescription, f.MetaKeywords 
FROM f (NOLOCK) 
join (select distinct f.id, min(dbo.CalculateDistance(@Latitude, @Longitude, z.Latitude, z.Longitude)) 'Distance' 
        FROM f2 (NOLOCK) 
        join FZipCode fz (NOLOCK) on f2.id = fz.FID 
        join (select distinct ZipCode, Latitude, Longitude from ZipCodes (NOLOCK)) z on z.ZIPCode = fz.ZIPCode 
        where f.Activated = 1 and dbo.CalculateDistance(@Latitude, @Longitude, z.Latitude, z.Longitude) <= 30 
        group by f2.id) dist on f.id = dist.FID 
order by Distance


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.