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

C#SqlSql ServerTsqlDouble

C# Problem Overview


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

C# Solutions


Solution 1 - C#

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

Solution 2 - C#

That would be float.

See Mapping CLR Parameter Data.

Solution 3 - C#

Float is the sql type you are looking for.

Solution 4 - C#

float matches best. real is only 32 bits in precision, so essentially useless.

See: http://msdn.microsoft.com/en-us/library/ms173773.aspx

Solution 5 - C#

"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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMetaGuruView Question on Stackoverflow
Solution 1 - C#DavidView Answer on Stackoverflow
Solution 2 - C#D'Arcy RittichView Answer on Stackoverflow
Solution 3 - C#Otávio DécioView Answer on Stackoverflow
Solution 4 - C#Philippe LeybaertView Answer on Stackoverflow
Solution 5 - C#Michal DobrodenkaView Answer on Stackoverflow