Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2005, 06:32 AM
Authorized User
 
Join Date: Sep 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default working with money values in sql server

Hi,

I'm not used to working with the money values.

Can you tell me the best way to store salaries(£) in a DB?

I'm using the int datatype at the moment, but I'm having trouble entering values into my db, 8,000 enters as 80,000.

TIA

 
Old September 22nd, 2005, 06:55 AM
Authorized User
 
Join Date: Sep 2005
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use money or float

http://sqlservercode.blogspot.com/
 
Old September 22nd, 2005, 05:25 PM
Authorized User
 
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default


 I like to use DEC(9,3)for money types. That's somewhat arbitrary, but I started using it when I had to develop some stuff that took a datafeed from a major securities rating company, so I figured it was credible based on that.

Regards,
Meredith Shaebanyan

 
Old September 29th, 2005, 08:15 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think Money, numeric or Dec work but I disagree with another above. I would NOT use float. Float is an aporximate value. You can get into situations where you stored 12.34, but what you get returned is 12.33. Although that data type does save space and have a lot of flexibility it can cause slight variations in what you saved vs what was returned and displayed to you users. It is also a common problem in accurate detailed calculations.






Similar Threads
Thread Thread Starter Forum Replies Last Post
rounding up SqlDbType.Money TYPE in sql server olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 2 December 9th, 2005 04:46 PM
geting money type from sql msrnivas Classic ASP Components 1 July 19th, 2004 11:09 AM
geting money type from sql msrnivas .NET Web Services 1 July 19th, 2004 06:36 AM
How Can SQL Server working with ASP??? aliasp SQL Server ASP 1 March 18th, 2004 03:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.