Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to sum varbinary(max) column in sql server

$
0
0

Hi Techies,

I have column called "UserAccessBit" with VarBinary(max) datatype. Now i would like to perform SUM operation on that column.see the following sample

select SUM(AccessBit) from UserAccess

Ex :

 DECLARE @vbtest TABLE(  
  al varbinary(max)  
  )
  insert into @vbtest values(0x0000000000000004)
  insert into @vbtest values(0x0000000000000006)
  insert into @vbtest values(0x0000000000000008)
  select sum(al) from @vbtest

But I'm getting error that can not perform sum operation on varbinary column.

Note : i can not convert to int/Bigint because my varbinary value is bigger than bigint datatype.

Please help on this. Is there any user defined function to do sum .

Regards,

Rama


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>