eg
if @bla = 1
begin
select *
from ReallyComplexView
where x = y
end
else
begin
select *
from ReallyComplexView
where (x = z) or (a=1) or (xyz = abc)...
end
that way you don't have to duplicate your select statement and joins etc
hth
Antony
On 9/14/05, Rod Higgins <
[EMAIL PROTECTED]> wrote:
> select *
> from table
> if (@bla = 1)
> where x = y
> else
> where x = z
declare @qryStr varchar(300)
set @qryStr = "select * from table where 1=1"
if(@bla=1)
set @qryStr = @qryStr + " and x=y"
else
set @qryStr = @qryStr + " and x=z"
exec(@qryStr)
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
--- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
