April 8, 2011 at 7:03 pm
Try this :
select *
from blah
where
blah = blah
and blah = blah
and (
(@ActivityStatusID=1 and ACS.[Description] = 'Completed')
or
(@ActivityStatusID<>1 and ACS.[Description] <> 'Completed')
)
April 8, 2011 at 8:02 pm
jaya53 (4/8/2011)
Try this :select *
from blah
where
blah = blah
and blah = blah
and (
(@ActivityStatusID=1 and ACS.[Description] = 'Completed')
or
(@ActivityStatusID<>1 and ACS.[Description] <> 'Completed')
)
I knew it was there somewhere....nicely done.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 9, 2011 at 6:28 am
Thanks jaya53, I'll give that a try on Monday.
But, in all to get it working for my boss to view over the weekend I just did.
If @activityStatusID = 1
select..
where
ACS.Discription='Complete'
else if @activitystatusid = 2
select...
where
acs.description <> 'complete'
else
select all.
Thanks,
KS.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply