Hi,
I have the following query which uses a date variable, which is generated inside the stored procedure:
DECLARE @sp_Date DATETIME
SET @sp_Date = DateAdd(m, -6, GETDATE())
SELECT DISTINCT pat.PublicationID
FROM PubAdvTransData AS pat
INNER JOIN PubAdvertiser AS pa ON pat.AdvTransID = pa.AdvTransID
WHERE (pat.LastAdDate > @sp_Date) AND (pa.AdvertiserID = 12345))
The problem is that the @sp_Date value appears to be being ignored and I am wondering why? Have I defined or used it incorrectly?
sql microsoft sql-server-2008
User error...
Thanks, R.