How can we write a dynamic where condition in sql which will change according to certain variable like
if @changestatus=0
Select * from table where status=0 and name is 'vivek_kumar9'
if @changestatus=1
Select * from table where status=1 and name is 'vivek_kumar'
I want to write a single query which will change vased on variable value..