Bill,
I'm a little unclear on what you mean by "won't run".
If you're using SQL Server:
-are you looking for output conditional on the value of a field? Use the
CASE statement within the select.
-"END" goes with "BEGIN" not with "IF". Do you mean "END" to mean not use
that row in your query?
-in your where clause, why not use "WHERE Active = @Active"?
Mark
is there anyway to do the if in the query of a stored procedure without
using a Cursor.
and this is what i wanted
Select *
from member
where membernumber<>0
and active='y'
and test='no'
order by membernumber
by using this type logic
select *
from member
where membernumber<>0
IF @active is 'y'
and active='y'
END
IF @test is 'y'
and test='no'
END
order by membernumber
so that by using a stored procedure i can say is active is N then the (and
active='y') wont run properly.
=)
hope that helps
@@@@@@@@@@@@@@@@@@@@@
Here's an example script I was given that show how you can loop through a
query using a cursor. Hope it helps.
Rick
-----Original Message-----
From: William J Wheatley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 24, 2001 12:20 PM
To: CF-Talk
Subject: OT SQL STORED PROCEDURES
WITH THE IF/ELSE/ on Stored Procedures is there a way to write a storedproc
so it was like this
SELECT *
from member
where membernumber <>0
IF @name is "0"
and name='blah'
end
if @this eq "that"
and that='test'
end
to make it only run certain things if certain values are set
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists