|
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER procedure CombinedSearch
@StartTime smalldatetime,
@EndTime smalldatetime,
@empState varchar (100) = null
as
if @empState <> null
select * from jobseeker
where (@StartTime <= InterviewTime and @EndTime> = InterviewTime) and empState = @ empState
else if @ empState = null
select * from jobseeker
where (@StartTime <= InterviewTime and @EndTime> = InterviewTime)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
The goal is to run different branches with and without values in @empState. The establishment of stored procedures is no problem. But when I run this stored procedure, I can't find the results. But there should be qualified results. Please take a look. |
|