Questions tagged «sqldatatypes»

与SQL一起使用的数据类型。


2
为什么在SQL中为199.96-0 = 200?
我有些客户的账单很奇怪。我能够找出核心问题: SELECT 199.96 - (0.0 * FLOOR(CAST(1.0 AS DECIMAL(19, 4)) * CAST(199.96 AS DECIMAL(19, 4)))) -- 200 what the? SELECT 199.96 - (0.0 * FLOOR(1.0 * CAST(199.96 AS DECIMAL(19, 4)))) -- 199.96 SELECT 199.96 - (0.0 * FLOOR(CAST(1.0 AS DECIMAL(19, 4)) * 199.96)) -- 199.96 SELECT 199.96 - (CAST(0.0 AS …

4
为什么SQL Server不支持无符号数据类型?
我专门在考虑未签名int。 这是一个实际的示例:当您的身份列超出限制时该怎么办?可以BigInt(存储8个字节而不是4个字节)或重构应用程序以支持负整数,甚至可以按照此答案创建自己的规则;这些选项都不是最佳选择。 UInt 会是一个理想的解决方案,但SQL Server不提供(MySQL提供)。 我知道无符号数据类型不是SQL标准(SQL-2003)的一部分,但对我来说似乎仍然很浪费。 不包括这些内容的原因是什么(在SQL Server或标准中)?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.