十进制 T-SQL 到十进制 C#

Decimal T-SQL to Decimal C#

在 C# 中将 T-SQL decimal(30,8) 转换为 decimal 是否可能出现潜在问题?

您不能用 .NET 的 System.Decimal 类型表示 decimal(30,8) 的所有可能值。

decimal(30,8) 有 30 位有效数字,System.Decimal 根据 the documentation.

有 28-29

例如 1234567890123456789012.12345678decimal(30,8) 的有效值,但在 C# returns 1234567890123456789012.1234568 中写入 1234567890123456789012.12345678m,四舍五入并缺少一个数字。