哪种 sql server 数据类型最能代表 C# 中的双精度值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1440620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 16:34:42  来源:igfitidea点击:

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

c#sqlsql-servertsqldouble

提问by MetaGuru

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

是货币、浮点数、实数、十进制数、_____ 吗?

采纳答案by David

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

可以在此处找到对此的回答以及所有类型的映射。

SQL-CLR Type Mapping

SQL-CLR 类型映射

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

2013 年 1 月 7 日更新 - 有一个更新的版本,这里不是那么丰富多彩: SQL Server 数据类型映射

回答by Otávio Décio

Float is the sql type you are looking for.

Float 是您要查找的 sql 类型。

回答by RedFilter

That would be float.

那将是浮动的。

See Mapping CLR Parameter Data.

请参阅映射 CLR 参数数据

回答by Philippe Leybaert

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

浮动匹配最好。real 的精度只有 32 位,所以基本上没用。

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

请参阅:http: //msdn.microsoft.com/en-us/library/ms173773.aspx

回答by Michal Dobrodenka

"The synonym for double precision is float(53)." Default value of n is 53.

“双精度的同义词是 float(53)。” n 的默认值为 53。

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

从页面http://msdn.microsoft.com/en-us/library/ms173773.aspx