
May 2nd, 2012, 02:36 PM
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 22
Time spent in forums: 6 h 50 m 52 sec
Reputation Power: 0
|
|
|
If with variable in Where Clause
In Stored Procedure
Variable @offnum (integer)
is passed either a number or nothing
how can I do this for my where clause:
If (@offnum) Is Null
(Employee.Empoff like '%')
Else
(Employee.Empoff = @offnum)
End
If I leave it as null I don't get what I want.
Edit -Or it could be
If NOT @offnum is Null
(Employee.Empoff = @offnum)
with no else, just ignore it if it's null
Thank you.
|