判断语句
SQL 里面判断语句 用一个"="号 表示是否相等
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
alter PROCEDURE LatestDealConfig
(
@SDate datetime,
@EDate datetime
)
AS
if (datediff(second,@EDate,@SDate)=0)
begin
SELECT *
FROM Sms_Receive
WHERE (Content LIKE '%#%') and Submit_time<@EDate
ORDER BY Submit_time DESC
end
else
begin
SELECT *
FROM Sms_Receive
WHERE (Content LIKE '%#%') and Submit_time >=@SDate and Submit_time<@EDate
ORDER BY Submit_time DESC
end