Is it money, float, real, decimal, _________ ?
Asked
Active
Viewed 5.6k times
5 Answers
169
Answer to this and all mapping of types can be found here.
Chart, stolen from that page:
Updated 1/7/2013 - there's a more recent version, .not so colorful here: SQL Server Data Type Mappings
-
2
-
@pseudonym27 - That has to do with how well the operating system can be expected to translate SQL Server data types into .NET Runtime data types and vice-versa. Any time you go between two different platforms there's a risk of data loss because the binary implementation of eachtype is not guaranteed to be the same. Also, not all numeric data types are able to be accurately represented in binary, so the system stores only the approximate value. See http://stackoverflow.com/questions/618535/what-is-the-difference-between-decimal-float-and-double-in-net – David Oct 21 '14 at 14:55
-
This chart is pretty, but wrong - it lists ...Enum as if there's some way to generally convert those to DB types, but enums behave as their underlying integral type (i.e. most are int32's and roundtrip precisely with db ints); and it suggests that char(1) is equivalent to a .net char - when unicode clearly implies that it isn't. Also, Date and DateTime *clearly* do not mutually roundtrip... and when mapping a DB real to a .net decimal, you can get dataloss also when saving to the database... I didn't check exhaustively, but this chart looks like garbage. – Eamon Nerbonne Sep 12 '18 at 07:53
-
@EamonNerbonne, the chart says "without data loss exceptions", not "without data loss". Does your comment still stand? – OutstandingBill Oct 15 '18 at 00:54
7
Float is the sql type you are looking for.

Otávio Décio
- 73,752
- 17
- 161
- 228
-
2You are right that is the best match. Sadly Float is one of the worst datatypes you can use in SQL Server if you will need to perform math onthe field later as it creates rounding errors since it is not exact. As a dba I would not want people to define fields as float as I have had to deal with the mess they create when you want to do reporting on the data in the database and the calculations are incorrect. – HLGEM Sep 17 '09 at 19:05
3
float matches best. real is only 32 bits in precision, so essentially useless.

Philippe Leybaert
- 168,566
- 31
- 210
- 223
1
"The synonym for double precision is float(53)." Default value of n is 53.
From page http://msdn.microsoft.com/en-us/library/ms173773.aspx

Michal Dobrodenka
- 1,104
- 8
- 27