eveCalypso
Programmer
Hello All,
I would like my SQL statement to do the following:
...
where (@givenID = 0 or (@givenID<>0 and myColumn = @givenID)
That means that if my user selected "All", it must not concern itself with the value for myColumn, otherwise, it must set myColumn = to the ID selected by the user.
I have 4 such inputs, how would you do it in SQL - is it possible? The statement will live in a stored procedure. The statement above is not quite correct yet, but I am sure there must be a way!
Regards,
EvE
I would like my SQL statement to do the following:
...
where (@givenID = 0 or (@givenID<>0 and myColumn = @givenID)
That means that if my user selected "All", it must not concern itself with the value for myColumn, otherwise, it must set myColumn = to the ID selected by the user.
I have 4 such inputs, how would you do it in SQL - is it possible? The statement will live in a stored procedure. The statement above is not quite correct yet, but I am sure there must be a way!
Regards,
EvE