将 datetime2 转换为 datetime 时出现“超出范围”错误

2024-03-28

我有一张桌子(table1) with StartDate, StartTime, EndTime, all datetime2 and an OverMidnight布尔值,指定是否EndDate将与 (+1) 不同StartDate.

我需要将它们移动到另一个表(table2) 与列StartDate and an EndDate,两者都需要是datetime类型和使用StartDate with StartTime得到新的StartDate and StartDate, OverMidnight, and EndTime得到EndDate.

无论我尝试什么,它都会给我一个错误:

datetime2 数据类型到 datetime 数据类型的转换 导致值超出范围。


DATETIME http://msdn.microsoft.com/en-gb/library/ms187819.aspx and 日期时间2 http://msdn.microsoft.com/en-us/library/bb677335.aspx有不同的可接受的日期范围。

约会时间:

1753年1月1日至9999年12月31日

日期时间2:

0001-01-01 至 9999-12-31

我会检查你的原始数据中是否有任何日期DATETIME范围或您的转换代码是否创建超出范围的日期DATETIME误差范围。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将 datetime2 转换为 datetime 时出现“超出范围”错误 的相关文章

随机推荐