tags:

views:

319

answers:

1

I've got a Clr user defined type that takes a string of values sepertated by a comma.

I'm losing a little bit of precision when converting to this type, I've narrowed it down to this line of code:

cast(cast(nlinkjt as nvarchar(100)) + ',' +cast(avglrwf as nvarchar(100)) + ',' + cast(avglrwfjt as nvarchar(100)) as dbo.CLRJourneyTime) as clrJT

output = 29.9376,5.29633e-005,0.00158559

but the orignal values are like so:

nlinkjt = 29.9376097988521  = cast(nlinkjt as nvarchar)  = 29.9376
avglrwf = 5.29632961843163E-05  = cast(avglrwf as nvarchar) = 5.29633e-005
avglrwfjt =  0.00158559449482709  = cast(avglrwfjt as nvarchar) = 0.00158559

how can i convert the floats to a string in full?

Or is there another way of declaring a new dbo.CLRJourneyTime like you would in .net like so:

'new dbo.CLRJourneyTime(nlinkjt , avglrwf , avglrwfjt ) as clrJT'
+1  A: 

Ok, Just found out that the float column only stored to about 4 decimal places anyways.. so it probably wont matter.

Hath