|
-
June 28th, 2009, 08:23 PM
#1
FLOAT vs NUMERIC for financial transaction
hello
Do you use FLOAT or NUMERIC for financial transaction? If NUMERIC, what precision? For M$SQL, looks like float offers more digits.
Thanks
http://doc.ddart.net/mssql/sql70/da-db_1.htm
-
June 29th, 2009, 01:49 AM
#2
Re: FLOAT vs NUMERIC for financial transaction
Use Decimal due to accuracy.
And the precision is then decided by your requirements. Most of the time 2-4 seems to be the norm (I mostly use 4).
-
June 29th, 2009, 02:35 AM
#3
Re: FLOAT vs NUMERIC for financial transaction
Hi all.
M$SQL provides "money", a specific data type for monetary data values.
In my opinion it's the best choice.
-
June 29th, 2009, 02:38 AM
#4
Re: FLOAT vs NUMERIC for financial transaction
Thanks guys, my preference is NUMERIC because NUMERIC is compatible with Mysql, Oracle, and MSSQL
-
June 29th, 2009, 04:10 AM
#5
Re: FLOAT vs NUMERIC for financial transaction
 Originally Posted by THY02K
Thanks guys, my preference is NUMERIC because NUMERIC is compatible with Mysql, Oracle, and MSSQL
Numeric is the same as a decimal. Just another keyword.
-
June 30th, 2009, 02:48 AM
#6
Re: FLOAT vs NUMERIC for financial transaction
AFAIK, Numeric can be as big and as precise as u want it. In oracle (I think ODBC standard too) numeric can be 20.8. But float or double is 8 bytes. But I always numeric. There is in my constant (I forgot the source) I put some comment below (which I think I copied either from MS or Oracle header).
SQL_CHARSQL_VARCHARSQL_LONGVARCHAR The defined length of the column. For example, the length of a column defined as CHAR(10) is 10.
SQL_LONGVARCHAR The maximum length of the column.
SQL_DECIMALSQL_NUMERIC The maximum number of digits plus two. Since these data types are returned as character strings, characters are needed for the digits, a sign, and a decimal point. For example, the length of a column defined as NUMERIC(10,3) is 12.
SQL_SMALLINT 2 (two bytes).
SQL_INTEGER 4 (four bytes).
SQL_BIGINT 20 (since this data type is returned as a character string, characters are needed for 19 digits and a sign).
SQL_REAL 4 (four bytes).
SQL_FLOAT 8 (eight bytes).
SQL_DOUBLE 8 (eight bytes).
SQL_BINARYSQL_VARBINARY The defined length of the column. For example, the length of a column defined as BINARY(10) is 10.
SQL_LONGVARBINARY The maximum length of the column.
SQL_DATESQL_TIME 6 (the size of the DATE_STRUCT or TIME_STRUCT structure).
SQL_TIMESTAMP 16 (the size of the TIMESTAMP_STRUCT structure).
Last edited by binyo66; June 30th, 2009 at 02:50 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|