
Announcements
It sounds like you're encountering a precision issue with the datetime values being passed from PowerApps to your SQL stored procedure. This is a common problem, especially when dealing with milliseconds.
Here are a few suggestions that might help resolve this issue:
Ensure Millisecond Precision: SQL Server's DATETIME type rounds to increments of .000, .003, or .007 seconds. If millisecond precision is crucial, consider using DATETIME2 which offers higher precision.
Format Datetime Correctly: When passing datetime values from PowerApps, ensure they are formatted correctly. You can use the format yyyy-MM-dd HH:mm:ss.fff to include milliseconds.
Convert Epoch Time: If you decide to pass epoch time, you can convert it to datetime in SQL using DATEADD. Here's an example:
DECLARE @EpochTime BIGINT = 1673876324947; -- Example epoch time
DECLARE @DateTime DATETIME2 = DATEADD(MILLISECOND, @EpochTime % 1000, DATEADD(SECOND, @EpochTime / 1000, '1970-01-01'));
Check PowerApps Configuration: Ensure that PowerApps is correctly passing the datetime value with milliseconds. Sometimes, the issue might be with how PowerApps formats or sends the data.
Stored Procedure Adjustment: If changing the stored procedure to accept epoch time is feasible, it might be a reliable workaround. However, ensure that the conversion logic is robust and handles edge cases.
Debugging: Since you don't have access to SQL logs, consider adding logging within your stored procedure to capture the exact datetime values being passed. This can help identify if the issue is with the data being received or the comparison logic.
If the response is helpful to you, a like or mark as the correct solution. thank you so much!