(cast(RegionFilter as int) & cast(@RegionFilter as int)) <> 0)

解决方案 »

  1.   

    左边操作数 右边操作数 
    binary int、smallint 或 tinyint 
    bit int、smallint、tinyint 或 bit 
    int int、smallint、tinyint、binary 或 varbinary 
    smallint int、smallint、tinyint、binary 或 varbinary 
    tinyint int、smallint、tinyint、binary 或 varbinary 
    varbinary int、smallint 或 tinyint 
      

  2.   

    所以还是转换为int以后再用位操作。
      

  3.   

    溢出呢?那两个都在十位以上啊 bigint也受不了况且7.0没有bigint
      

  4.   

    还是不行 binary varbinary还是同样错误
      

  5.   

    做了个例子,供参考declare @a decimal(38,0)
    declare @b decimal(38,0)
    declare @c binary(32)
    declare @d binary(32)
    declare @e1 binary(8)
    declare @e2 binary(8)
    declare @e3 binary(8)
    declare @e4 binary(8)
    declare @result decimal(38,0)select @a=12345678901234567890123456789012345678
    select @b=23456789012345678901234567890123456788select @c=convert(binary(32),@a)
    select @d=convert(binary(32),@b)
    select @e1=convert(int,substring(@c,1,8))|substring(@d,1,8)
    select @e2=convert(int,substring(@c,9,8))|substring(@d,9,8)
    select @e3=convert(int,substring(@c,17,8))|substring(@d,17,8)
    select @e4=convert(int,substring(@c,25,8))|substring(@d,25,8)
    select @c
    select @d
    select @e1,@e2,@e3,@e4
    select @e1+@e2+@e3+@e4
    select @result=convert(decimal(38,0),@e1+@e2+@e3+@e4)select @result