create proc sp_NEWreport01
(
@FromDate char(10),
@ToDate char(10),
@FromTime char(11),
@ToTime char(11),
@SiteNum char(2),
@FromSID Char(6),
@ToSID Char(6),
@GID char(13),
@CallType char(1),
@SortOrder char(1)
)
as
IF (@FromDate = @ToDate)
BEGIN
SELECT
f_call_date, f_call_time, f_call_siteid,
f_call_calltype,
CASE WHEN f_call_galias = '' THEN f_call_sid ELSE f_call_galias END
CALLNAME,
f_call_chnumber,
CASE WHEN f_call_delay = '1' THEN f_call_duration ELSE 0 END
DELAYTIME,
CASE WHEN f_call_delay = '0' THEN f_call_duration ELSE 0 END
CALLTIME
FROM
t_details
GROUP BY
f_call_date
HAVING
f_call_date = @FromDate and
f_call_time between @FromTime and @ToTime and
f_call_sid between @FromSID and @ToSID and
f_call_pid like @GID and
f_call_siteid like @SiteNum and
IF @CallType= '%' /* 이부분에서 계속 에러가 나네요..--*/
BEGIN
f_call_calltype ='1'
END
END
===========================
에러
Server Message: Number 156, Severity 15
Procedure 'sp_NEWreport01', Line 37:
Incorrect syntax near the keyword 'IF'.
Server Message: Number 102, Severity 15
Procedure 'sp_NEWreport01', Line 39:
Incorrect syntax near 'f_call_calltype'.
원인 파악좀 해주세요...
필드명은 틀리지 않았는데...
|