The forum is currently being migrated to a new host. While the migration happens, the old server is still available. Once the new machine is ready, I will copy the database to the new machine. Feel free to ask and answer questions in the meantime.

I'm using NHibernate ( to access my SA12 database. Currently I have an linq expression that take sum of a column [type: numeric(19,2)] but sa server is throwing an exception since generated sql is something like

select sum(cast(value as numeric(19,255)))

I know numeric(19,255) is invalid. But now I have 2 questions:

  1. How to solve / work around?
  2. Why using NHibernate with sa11 dialect it works?

Thank you.

asked 14 Nov '12, 14:51

Zote's gravatar image

accept rate: 43%

edited 16 Nov '12, 13:25

Jeff%20Albion's gravatar image

Jeff Albion

I had this problem too!

(16 Nov '12, 04:54) Tuschinski

Currently I have an linq expression that take sum of a column [type: numeric(19,2)]

Can you post the LINQ code that you're using to calculate this expression?

Why using NHibernate with sa11 dialect it works?

Have you tried the SA12 dialect with NHibernate also? Do you see the same issue?

How to solve / work around?

If you examine the SQL Anywhere 11 Dialect code for how the dialect handles the NUMERIC type:

 RegisterColumnType( DbType.Decimal, "NUMERIC(19,$l)" ); // Precision ranges from 0-127

and the (Java) Hibernate documentation describes how $l (length, or scale) is automatically passed in by the Hibernate framework. It's possible that this mechanism has changed somehow in - we'll need more details from you to help confirm this.

(16 Nov '12, 13:25) Jeff Albion

Jeff, I'll analyze your questions and reply tomorrow.

(19 Nov '12, 14:01) Zote
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Nov '12, 14:51

question was seen: 1,642 times

last updated: 19 Nov '12, 14:01