SELECT
sr.InsertedDate AS SMSDateTime,
sib.MessageText AS SMS_Text, sib.Remarks
FROM
SMSInbound sib
INNER JOIN
SMSReceived sr ON sr.ReceivedId = sib.ReceiveId
WHERE
sib.MessageType LIKE '%ER%'
AND datepart(day,sr.InsertedDate) = @Day
AND datepart(month,sr.InsertedDate) = @Month
AND datepart(year,sr.InsertedDate) = datepart(year, getdate()).Replace("@Day", day).Replace("@Month", Month);
我要尝试编写此查询的存储过程,但是这行
AND datepart(year,sr.InsertedDate) = datepart(year,getdate()).Replace("@Day", day).Replace("@Month", Month);
导致datepart(year,getdate())
有人愿意提供帮助,我们将不胜感激。