Create function Getresults(@adminID varchar(20),@adminrole int,@condition nvarchar(max))
returns table
as
(
Select a.tno,
case @adminrole
when 1 then 1
when 3 then
case
when a.status in('setup','process') then 1 else 0
end
end as rolestatus,
case when a.requestortype ='bulkprocess' then 'N/A'
else a.requestorno
end as requestorno,
case when (fnallowedstate(@adminid) = 1 then 'active' else 'inactive'as state,
b.starttime,
b.endtime
from Rules A join ruledetails B on a.ruleid = b.ruleid(this is guid)
where @adminrole in(1,3,2,4)
)
i want to add more conditions to the where clause but the conditions are based on the calculated columns in the above query. like Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE