2

I have a sql server column defined decimal(32,15). When I try to read it using SqlDataReader.GetValue(), I find that the maximum db value that can be accommodated is 79,228,162,514,264. A larger value throws an overflowexception. This is surprising, since the .net decimal type is 128 bits and provides 28 to 29 digits of precision. Can someone explain?

2 Answers 2

2

Use SqlDataReader.GetSqlDecimal() instead of SqlDataReader.GetValue().

Here is an example of the problem in detail:

http://weblogs.sqlteam.com/mladenp/archive/2010/08/31/when-does-sql-server-decimal-not-convert-to-net-decimal.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting. Thanks for the link. Looks like a .net defect.
1

This also works: SqlDataReader.GetProviderSpecificValue()

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.