get rdl select all filter

My report has a filter (Active_Flag) refers to a  bit data type field. It is a flag. At report design time, I set it as int type, and give it 3 value as:
Active  1
Inactive 0
Both    -1

But at store procedure side, I need help to get its value so that I can compare the value again DB to select rows.

I used the following two query but not successfully, and the filter does not work well. I doubt if I used the right way to do it. Plese help. Thanks.

Select Distinct ID, FirstName + ' ' + LastName AS EmpName
From  mytable t
Where ( (@Active_Flag=-1) OR (t.IsActive = @Active_Flag))
                        

Select Distinct ID, FirstName + ' ' + LastName AS EmpName
From  mytable t
Where ( (convert(varchar(5),@Active_Flag)='-1') OR (t.IsActive = @Active_Flag))
LVL 1
minglelinchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Offhand your T-SQL looks correct.

What is the datatype (bit, int) being passed to the SP, and what is the datatype of mytable.IsActive?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
minglelinchAuthor Commented:
Thanks for the comment. I used int type for the query -

Select Distinct ID, FirstName + ' ' + LastName AS EmpName
From  mytable t
Where ( (@Active_Flag=-1) OR (t.IsActive = @Active_Flag))

I used varchar type for the second query. But I defined the flag as int at report design time, so now I defined it as int at SP. IsActive is bit type at DB.
0
ValentinoVBI ConsultantCommented:
Looks fine for me too, can you explain a bit more what you mean with "the filter does not work well"?  What happens when you try different parameter values?
0
minglelinchAuthor Commented:
Thank you both for confirming it is fine. It turns out the data/business issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSRS

From novice to tech pro — start learning today.