|
|
|
Rank: Member
Groups: Member
Joined: 6/13/2009 Posts: 3 Points: 9 Location: Israel
|
you have a bug in CASE Statement the following will return an invalid cast
DECLARE @i int SET @i=5 SELECT (CASE WHEN @i>0 THEN @i ELSE 0 END)
|
|
|
|
Rank: VistaDB Staff
Groups: Administration, VistaDB Staff
Joined: 8/13/2006 Posts: 3,362 Points: 3,891 Location: Mount Dora, Florida
|
I think that case promotes all values to BigInt internally. So will probably have to declare your variable as a BigInt to run like that. We do already have this marked as a problem, but to change the internal behavior might break lots of users apps because they are expecting that behavior. Jason Short
|
|
|
|
Rank: Member
Groups: Member
Joined: 6/13/2009 Posts: 3 Points: 9 Location: Israel
|
If you are promoting to Bigint I would expect an implicit cast from int. Regardless I think you need a better error message or to flag this as an SQL error, i encountered this issue at runtime when executing a large SP, and the debugging process was painful.
|
|
|
|
Rank: VistaDB Staff
Groups: Administration, VistaDB Staff
Joined: 8/13/2006 Posts: 3,362 Points: 3,891 Location: Mount Dora, Florida
|
Agreed - the error message is painful. But that is the error message from .Net on the conversion. It will not convert it through a simple cast. You have to call Convert.Toxxxx() for it to work and the code at that point is all generic (doesn't know what the types are and is trying to use implicit casting). Jason Short
|
|
|
|
Guest
|
YAFPro Theme Created by Jaben Cargman (Tiny Gecko)Powered by YAF 1.9.3 |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 0.064 seconds.