December 9, 2008 at 12:35 am
Hi,
plz see dis simple script. What's going wrong with the varbinary data while converting to float?? Here I used the built-in encryption-decryption functions in 2005 which returns varbinary.
Plz help
declare @a varbinary(100)
declare @b-2 varbinary(100)
declare @f float
set @f=123.456
set @a=EncryptByPassPhrase('vival', cast(@f as varbinary))
set @b-2=DecryptByPassPhrase('vival', @a)
print @b-2
print cast(cast(@b as decimal(10,4)) as float)
December 9, 2008 at 2:43 am
As a guess, another case where float's inaccuracy gives problems. The number been cast back to decimal probably has too many decimal places to fit in the specified scale.
If you declare @f as a decimal, it works fine.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply