~donaldw/dbversion/verify-feature

« back to all changes in this revision

Viewing changes to samples/library/3/llAreasNearLocation.sql

  • Committer: Adam Connelly
  • Date: 2012-01-24 22:01:24 UTC
  • Revision ID: adam.rpconnelly@gmail.com-20120124220124-zi1dcqbt7bo8ie77
Updating ScriptTask so that it uses the current connection from the NHibernate session to create a command, and then uses that command to execute the script. Previously it was using ISession.CreateSQLQuery. The problem with CreateSQLQuery is that it parses the SQL text for parameters which can cause executing the script to fail.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CREATE FUNCTION [dbo].[llAreasNearLocation]
 
2
(
 
3
        @Latitude float,
 
4
        @Longitude float,
 
5
        @RadiusMetres int
 
6
)
 
7
RETURNS TABLE
 
8
AS
 
9
RETURN
 
10
(
 
11
        select *
 
12
        from
 
13
        (select geography::Point(@Latitude, @Longitude, 4326).STDistance(Location) "Distance",
 
14
                *
 
15
        from GeographicArea) dist
 
16
        where dist.Distance <= @RadiusMetres
 
17
)
 
 
b'\\ No newline at end of file'