Hi I have the following SP in sql server and am getting an error. Incorrect result: no records returned. I figure my calculation is wrong.<BR><BR>here&#039;s the SP:<BR>CREATE procedure qry_Find_ProfileInfo<BR>(<BR>@Mbr_login varchar(120),<BR>@mbr_zipcode int<BR>)<BR>AS<BR>begin<BR>declare @LAT numeric(18,9)<BR>declare @LON numeric(18,9)<BR>declare @cosLat numeric(18,9)<BR>declare @fnLat numeric(18,9)<BR>declare @fnRad numeric(18,9) <BR>declare @minLat numeric(18,9)<BR>declare @maxLat numeric(18,9)<BR>declare @minLon numeric(18,9)<BR>declare @maxLon numeric(18,9)<BR>DECLARE @mbr_Verified varchar(3000)<BR>--DECLARE @SQL varchar(3000)<BR><BR>select @LAT = Latitude from ZIPCODES_TBL where zip_code = @mbr_zipcode<BR>select @LON = Longitude from ZIPCODES_TBL where zip_code = @mbr_zipcode<BR>select @cosLat = Cos( @LAT/57.3 ) <BR>select @fnLat = 5 / ((( @cosLat * 6076) / 5280) * 60)<BR>select @fnRad = 5 / ( 1.15 * 60 )<BR>select @minLat = @LAT - @fnRad<BR>select @maxLat = @LAT + @fnRad<BR>select @minLon = @LON - @fnLat<BR>select @maxLon = @LON + @fnLat <BR><BR>if exists(select Verified from VERIFICATION_TBL where Verified = &#039;y&#039; and Member_Lgn = @Mbr_login)<BR> begin<BR> set @mbr_Verified = &#039;y&#039;<BR> end<BR>else<BR> begin<BR> set @mbr_Verified = &#039;n&#039;<BR> end<BR><BR>SELECT ...,<BR>((SQUARE(69.1*(Latitude-@LAT)))+SQUARE(69.1*(Longitude-@LON)*@cosLat)) as distance<BR><BR>From CONTACT_INFO_TBL cit <BR>inner join LOGIN_TBL lt<BR> ON lt.Member_Lgn = cit.Member_Lgn<BR>inner JOIN PICTURES_TBL <BR> On PICTURES_TBL.Member_Lgn = lt.Member_Lgn<BR>inner join ACTIVITIES_TBL atbl<BR> ON lt.Member_Lgn = atbl.Member_Lgn<BR>inner join ACTIVITY_DESCRIPTION_TBL adt<BR> ON lt.Member_Lgn = adt.Member_Lgn<BR>inner join ZIPCODES_TBL zct<BR> ON cit.zip_code = zct.zip_code<BR>inner join MALE_PHYSICAL_PROFILE_TBL mpt<BR> ON lt.Member_Lgn = mpt.Member_Lgn<BR>inner join PREFERENCES_TBL pt<BR> ON lt.Member_Lgn = pt.Member_Lgn<BR><BR>WHERE (lt.Active_Inactive_Status = &#039;y&#039;) AND (lt.Member_Lgn = @Mbr_login) AND (Latitude BETWEEN @minLat AND @maxLat AND Longitude BETWEEN @minLon AND @maxLon)<BR>------------------------------------------------------------<BR><BR>print @LAT ==&#062;40.742794000<BR>print @LON ==&#062;73.918216000<BR>print @cosLat ==&#062;0.757681258<BR>print @fnLat ==&#062;0.095575893<BR>print @fnRad ==&#062;0.072463700<BR>print @minLat ==&#062;40.670330300<BR>print @maxLat ==&#062;40.815257700<BR>print @minLon ==&#062;73.822640107<BR>print @maxLon ==&#062;74.013791893<BR><BR>Removing "AND (Latitude BETWEEN @minLat AND @maxLat AND Longitude BETWEEN @minLon AND @maxLon)"in the where clause gives me a result but it seems to big to be exact. <BR><BR>Can anyone tell me whereI am going wrong.<BR>