Cast as decimal(38,12) in HQL
I'm using NHibernate with Active Record and I'm trying to sum up a column and return the result. The column is a decimal(38,12). However when I do this I get the SQL Exception:
"Arithmetic overflow开发者_运维知识库 error converting numeric to data type numeric"
I've ran the profiler and can see the problem is that the SQL query being generated is using decimal(19,5).
Any thoughts on how to get round this? I've included part of my HQL below:
select new MyObject(
cast(sum(abs(oo.Total)) as decimal)
)
from OtherObject oo
精彩评论