Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which sql server data type best represents a double in C#? [duplicate]

Is it money, float, real, decimal, _________ ?

like image 309
MetaGuru Avatar asked Sep 17 '09 18:09

MetaGuru


People also ask

What represents a double in SQL Server?

The decimal(x,y) SQL Server type is for when you want exact decimal numbers rather than floating point (which can be approximations). This is in contrast to the C# "decimal" data type, which is more like a 128-bit floating point number. MSSQL's float type is equivalent to the 64-bit double type in . NET.

What is best data type in SQL?

Fixed-point data types are perfect for number schemas that don't change like currency where you know you'll always have two digits to the right of the decimal point. Two fixed-point data types exist in SQL called decimal (DEC) and numeric (NUM).


2 Answers

Answer to this and all mapping of types can be found here.

SQL-CLR Type Mapping

Chart, stolen from that page:

enter image description here


Updated 1/7/2013 - there's a more recent version, .not so colorful here: SQL Server Data Type Mappings

like image 61
David Avatar answered Sep 20 '22 11:09

David


That would be float.

See Mapping CLR Parameter Data.

like image 34
D'Arcy Rittich Avatar answered Sep 18 '22 11:09

D'Arcy Rittich