To check any link or any information or any message is expired or not we always made a column IsExpired in SQL Server.
While accessing this values we always this value is expired or not
SELECT N.ID, N.Message, N.Url, U.FirstName + ' ' + U.LastName AS 'TargetUser', U2.FirstName + ' ' + U2.LastName AS 'CreatedBy',
CONVERT(VARCHAR(20), N.CreatedDate, 103) CreatedDate, C.Company, L.Location
FROM Nudge AS N INNER JOIN
[User] AS U ON N.TargetUserID = U.ID INNER JOIN
[User] AS U2 ON N.CreatedBy = U2.ID INNER JOIN
Location AS L ON N.LocationID = L.ID INNER JOIN
Company AS C ON L.CompanyID = C.ID
WHERE U.AccessToken = @AccessToken AND L.ID > 0 AND N.IsDeleted = 0 AND DATEDIFF(DAY, GETDATE(), N.ExpiryDate) > 0
ORDER BY CreatedDate DESC
0 Comment(s)