Create fails when script uses SQL Server 2008 Spatial types

Bug #921220 reported by Adam Connelly
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DB Version
Fix Committed
Critical
Adam Connelly

Bug Description

The script execution can fail when the script uses the SQL Server 2008 spatial API because it uses "::". dbversion uses NHibernate queries to execute scripts which parse colons as named parameters.

To solve this we can grab the connection from the hibernate session and create a command from it.

Here's some example code that can fail:

CREATE FUNCTION [dbo].[llAreasNearLocation]
(
 @Latitude float,
 @Longitude float,
 @RadiusMetres int
)
RETURNS TABLE
AS
RETURN
(
 select *
 from
 (select geography::Point(@Latitude, @Longitude, 4326).STDistance(Location) "Distance",
  *
 from GeographicArea) dist
 where dist.Distance <= @RadiusMetres
)

Tags: dbversion

Related branches

Changed in dbversion:
status: New → In Progress
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.