Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent of atn function
Message
 
 
À
13/04/2010 14:20:48
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01459871
Message ID:
01460014
Vues:
24
>>One more time - read the blog I gave you a reference a couple of times. It has all necessary methods listed including what you're looking for.
>
>Thanks, by reading that blog, I was able to obtain related items in my table by using this:
>
>
>declare @MinLatitude float
>declare @MinLongitude float
>declare @MaxLatitude float
>declare @MaxLongitude float
>declare @Latitude float=47.7795
>declare @Longitude float=-65.7191
>declare @Distance float=20
>
>-- Calculate the Max Lat/Long
>SELECT @MaxLongitude = dbo.LongitudePlusDistance(@Longitude, @Latitude,@Distance),
>       @MaxLatitude = dbo.LatitudePlusDistance(@Latitude,@Distance)
> 
>-- Calculate the min lat/long
>SELECT @MinLatitude = 2 * @Latitude - @MaxLatitude,
>       @MinLongitude = 2 * @Longitude - @MaxLongitude
> 
>-- The query to return all zips within a certain distance
>SELECT ZipCode, CITY
>FROM   ZipCodes
>WHERE  Longitude Between @MinLongitude And @MaxLongitude
>       And Latitude Between @MinLatitude And @MaxLatitude
>       And dbo.CalculateDistance(@Longitude, @Latitude, Longitude, Latitude) <=@Distance
>
>
>Now, I need to find a way to avoid using store procedures in this process. The first step would be to eliminate the first two stored procedures. Is there a way that this could be done?

You meant UDF. Instead of the UDF, you can put the code from that UDF inside your code. I'm not sure it will be quicker.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform