Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I'm using NHibernate (3.3.2.4000) 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 3.1.0.4000 with sa11 dialect it works?

Thank you.

asked 14 Nov '12, 14:51

Zote's gravatar image

Zote
1.7k364051
accept rate: 43%

edited 16 Nov '12, 13:25

Jeff%20Albion's gravatar image

Jeff Albion
10.8k171175

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 3.1.0.4000 with sa11 dialect it works?

Have you tried the SA12 dialect with NHibernate 3.1.0.4000 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 3.3.2.4000 - 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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×438
×19
×8
×4

question asked: 14 Nov '12, 14:51

question was seen: 2,129 times

last updated: 19 Nov '12, 14:01