-4
FROM [dbo].[SMS_ACTY]
WHERE CONTACT_ID NOT IN (SELECT
  CONTACT_ID 
FROM CONTACT) and cast(add_date as date) = CAST(@run_id AS DATE)

As the where clause suggests the select statement will return records is ADD_DATE is equal to the runid passed. If the runid is passed with yesterday's date, even if there potential records in the table, the select will not return any records. How can I make sure that no matter what the runid is passed it will provide data records of that runid

for Example :

if the ADD_DATE is 2020-03-23 and runid is 20200322 -- 0 records returned ( there could be records with ADD_DATE as 2020-03-22)

New contributor
Prajwal Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Browse other questions tagged or ask your own question.