Question : Arithmetic overflow during explicit conversion of NUMERIC value '2147483648' to a INT field .

Hi,

I'm trying to perform the below

   SELECT UD.id_user, #POT.n
   FROM    USER_DESK UD
   ,            #POT
   WHERE convert(int,UD.id_flg_desk) & #POT.n = #POT.n


but I get

>[Error] Script lines: 1-5 --------------------------
 Arithmetic overflow during explicit conversion of NUMERIC value '2147483648' to a INT field .

Clearly the int type is too small. What do I need to do to fix this. What data type should I use, stc. Thanks

Answer : Arithmetic overflow during explicit conversion of NUMERIC value '2147483648' to a INT field .

To use bitwise operators datatype must be integer type. You can use bigint instead of int:

SELECT UD.id_user, #POT.n
   FROM    USER_DESK UD
   ,            #POT
   WHERE convert(bigint,UD.id_flg_desk) & #POT.n = #POT.n

Note: I hope you are using an ASE 15
Random Solutions  
 
programming4us programming4us