Question: If one of the paramater is passed / or both passed how to match that to single column in WHERE clause.

If both are passed should get result set just with the first one else with second one.

Ex:

```
--either will be passed
declare @processStepID int = null
declare @PROCESS_StepID int = null

if(@processStepID is null)
select * from CTL.CTRL.CTRL_PROCESS_STEP_ACTIVITIES 
where PROCESS_STEP_ID = @PROCESS_StepID
else
select * from CTL.CTRL.CTRL_PROCESS_STEP_ACTIVITIES 
where PROCESS_STEP_ID = @processStepID

```

How can this be written in where clause not using if statement.

thanks

Answer: 
Use the [ISNULL](http://msdn.microsoft.com/en-us/library/aa933210(SQL.80).aspx) function

```
SELECT *
FROM CTL.CTRL.CTRL_PROCESS_STEP_ACTIVITIES 
WHERE PROCESS_STEP_ID = ISNULL( @processStepID, @PROCESS_StepID )

```
```
select * from CTL.CTRL.CTRL_PROCESS_STEP_ACTIVITIES 
where (PROCESS_STEP_ID = @PROCESS_StepID) OR (PROCESS_STEP_ID = @processStepID)

```

Seems far too obvious. What am I missing?