Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if the datediff function causes an overflow and the number of the date part used to separate two date / time instances is too large?

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

The datediff function causes an overflow and what to do if the number of the date part used to separate two date / time instances is too large. To solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Execute the script that checks for alwayson synchronization:

SELECT availability_mode_desc

Role_desc

Replica_server_name

Last_redone_time

GETDATE () now

DATEDIFF (ms, last_redone_time, GETDATE ()) diffMS

FROM ((sys.availability_groups AS ag

JOIN sys.availability_replicas AS ar ON ag.group_id = ar.group_id

)

JOIN sys.dm_hadr_availability_replica_states AS ar_state ON ar.replica_id = ar_state.replica_id

)

JOIN sys.dm_hadr_database_replica_states dr_state ON ag.group_id = dr_state.group_id

AND dr_state.replica_id = ar_state.replica_id

Error report:

The datediff function caused an overflow. The number used to separate the date part of the two date / time instances is too large. Try using datediff with lower precision in the date section.

1. It may be a date with a null value

2. Maybe the difference between the two dates is too far.

After inspection, it was found that the difference between the two dates was too far.

The time of last_redone_time is too different from that of GETDATE ().

Indicates that there is a library that has not been updated for a long time, so the value of last_redone_time has not changed for a long time.

Update the data in that library, the synchronization script is normal.

The answer to the question about the overflow caused by the datediff function and the large number of the date part used to separate the two date / time instances is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report