How can we help you today? How can we help you today?

Exception when loading a function into Source Control

I'm receiving the following Stack Trace when loading a function into Source Control using version 0.3:
Failed to update:
#oEc.#8Jf: Failed to parse file C:\Documents and Settings\Jason.M\Local Settings\Application Data\Red Gate\SQL Source Control 0\WorkingBases\64c806c3-9830-434b-9d93-b60c32841002\Functions\dbo.GetGreatCirckeDistanceKilometers.sql ---> #Eyg.#Ryg: Failed to parse file C:\Documents and Settings\Jason.M\Local Settings\Application Data\Red Gate\SQL Source Control 0\WorkingBases\64c806c3-9830-434b-9d93-b60c32841002\Functions\dbo.GetGreatCirckeDistanceKilometers.sql ---> line 42:22: unexpected char: 0xD
--- End of inner exception stack trace ---
at #oEc.#7Jf.#t.#B3.#sKf()
at #oEc.#7Jf.#gKf(Action action)
--- End of inner exception stack trace ---

Server stack trace:
at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#t.#izb.#j5f()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsThrowAll(Action action)
at #JLc.#PLc.#CTc(ICancellableOperation`1 operation, Object token)


The Function I'm loading is below:

ALTER function [dbo].[GetGreatCirckeDistanceKilometers]
	(
	@Latitude1  float,
	@Longitude1 float,
	@Latitude2  float,
	@Longitude2 float
	)
returns float
as

/*
FUNCTION: GetGreatCirckeDistanceKilometers

	Computes the Great Circle distance in kilometers
	between two points on the Earth using the
	Haversine formula distance calculation.

Input Parameters:
	@Longitude1 - Longitude in degrees of point 1
	@Latitude1  - Latitude  in degrees of point 1
	@Longitude2 - Longitude in degrees of point 2
	@Latitude2  - Latitude  in degrees of point 2
*/

begin
declare @radius float

declare @lon1  float
declare @lon2  float
declare @lat1  float
declare @lat2  float

declare @a float
declare @distance float

-- Sets average radius of Earth in Kilometers
set @radius = 6376.5E

-- Sets average radius of Earth in Miles
--set @radius = 3956.0E

-- Convert degrees to radians
set @lon1 = radians( @Longitude1 )
set @lon2 = radians( @Longitude2 )
set @lat1 = radians( @Latitude1 )
set @lat2 = radians( @Latitude2 )

set @a = sqrt(square(sin((@lat2-@lat1)/2.0E)) + 
	(cos(@lat1) * cos(@lat2) * square(sin((@lon2-@lon1)/2.0E))) )

set @distance =
	@radius * ( 2.0E *asin(case when 1.0E < @a then 1.0E else @a end ))

return @distance

end
jimithing1980
0

Comments

3 comments

  • StephanieHerr
    Thank you so much for including the stack track and the code for the function. We were able to replicate your issue. We are looking into a fix for this now. Our internal reference number is SOC-800.
    StephanieHerr
    0
  • jimithing1980
    I have already fixed it for now by removing the E in the float variables. I had to do it in a couple places (on the server, in source control, and in a temp directory) but that seems to be the bug.
    jimithing1980
    0
  • StephanieHerr
    Thanks for letting us know how you fixed it. The 3 places you mentioned make sense. I'll add this workaround to your issue and we'll see if there's a way we could prevent it from having this problem in the first place.
    StephanieHerr
    0

Add comment

Please sign in to leave a comment.