Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Money data type and two decimal places
 

Pages: 1
LLBLGen Pro Runtime Framework
Money data type and two decimal places
Page:1/1 

  Print all messages in this thread  
Poster Message
tprohas
User



Location:
Tucson, AZ
Joined on:
23-Mar-2004 00:00:43
Posted:
257 posts
# Posted on: 30-Nov-2006 22:54:33.  
I'm having a problem in our application where I save a monetary value and want to result to have two decimal places. The money data type always uses four so I'm thinking of using something like a decimal (18,2). Does anyone have any suggestions?
Aaron Prohaska
http://www.verdesoft.com/
 
Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14470 posts
# Posted on: 01-Dec-2006 08:10:04.  
Are you speaking from the Database design point of view?

I think decimal(18, 2) will do, the only difference is that it's 1 byte more in storage than the money data type.

decimal (18, 2) = 9 bytes
money = 8 bytes


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37405 posts
# Posted on: 01-Dec-2006 10:40:54.  
Which DB type are you using? Though I think a decimal will do better in this case. I think money uses 4 decimals on some db's to overcome rounding issues in signicant digits.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
tprohas
User



Location:
Tucson, AZ
Joined on:
23-Mar-2004 00:00:43
Posted:
257 posts
# Posted on: 01-Dec-2006 18:30:18.  
Maybe I'm asking if there is anyway to make a custom money type uses only two decimal places instead of four. I think I'll probably end up using the decimal (18,2) for this as the size I'm not concerned with right now.

Aaron Prohaska
http://www.verdesoft.com/
 
Top
Chester
Support Team



Location:
Chicago, IL USA
Joined on:
15-Jul-2005 22:38:41
Posted:
223 posts
# Posted on: 02-Dec-2006 23:46:16.  
Some DB's support custom data types, which are useful in exactly your scenario. You could create a custom data type in SQL Server called "currency" (not sure if that's a reserved word) as decimal(18,2). Then your columns would be of type "currency" and you could later change the custom data type if necessary.
  Top
wiredeye
User



Location:
USA
Joined on:
15-Jul-2008 15:46:26
Posted:
18 posts
# Posted on: 26-Sep-2008 16:34:22.  
I store a value on SQL Server 2005 as decimal(12,2). The number returned to me is a single and has a 3rd decimal changing "xxx.37" to "xxx.375". Can you point me to the area of LLBLGen Pro where I can stop that behavior? It causes issues with rounding.

Using Self-servicing 2.5

Thanks.


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37405 posts
# Posted on: 27-Sep-2008 14:48:53.  
A decimal type in sqlserver is mapped as a decimal in .NET, so I don't really see how this can be a 'single'. Do you use a type converter?

Also, next time please open a new thread instead of hijacking an old thread, thanks
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.