It completely depends on the application and what accuracy you need.
If we are talking about architecture, then the need for accuracy is relatively limited, and it C# 32-bit floatwill go a long way. In SQL, this means float(24)also called a database type real. This type of SQL DB requires 4 bytes of storage for each record.
, . a C# double , a SQL float(53) float. SQL DB 8 , / .
SQL Decimal SQL, 2 :
C# Decimal, , . # Decimal , float/double .. , , IMO.
"The type of decimal value is suitable for financial calculations requiring a large number of significant integral and fractional digits and rounding errors." - MSDN: decimal structure
- The SQL DB type
Decimalrequires 5–9 bytes of storage per record (depending on the precision used), which is larger than the float (x) alternatives.
Therefore, use it according to your needs. In your comment, you declare that it is about real estate, so I would go for float(24)(aka real), which is exactly 4 bytes and translates directly to C# float. See: float and real (Transact-SQL)Finally, here is a useful resource for converting different types between .Net and SQL: SqlDbType enumeration
source
share