where clause not show expected result.
declare @PracticeId bigint =1000
select * from insurance i
WHERE ISNULL(I.DELETED,0)=0
and (
( @PracticeId =1000 and(I.PracticeId=@PracticeId and I.PracticeId<>0) )
OR( (I.PracticeId=0 OR I.PracticeId=@PracticeId) and I.PracticeId<>1000 )
)
I want show result when
@practiceid=1000
than only 1000 practices show and when
practiceid <>1000
than show practiceid in (0,@practiceid)
but when i pass @practiceid=1000 than its also get 0 practiceid