Posted by parez on 11/06/05 21:38
Hi All,
I have a stored proc which looks like this.
Create ....
(
@id int,
@ud int,
@td int=0
)
if @td=0
select bkah from asdf where id=@id and ud=@ud
else
select bkah from asdf where id=@id and ud=@ud and td=@td
---------------------------------
I am wondering if i could replace if condition with the following line
select bkah from asdf where id=@id and ud=@ud
and ( @td<>0 and td>@td )
IS sql server 2000 smart enough not to use the td>@td in the query if
@td is 0
Thanks all
[Back to original message]
|