Sebastian
Try declaring the length of the variable
DECLARE @PollType CHAR(2)

Nick

-----Original Message-----
From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 05, 2001 3:46 PM
To: CF-Talk
Subject: Stored Procedures



In a stored procedure how can you run a conditional query based on the value
of a declared variable? The following does not work.

DECLARE @PollType CHAR

SELECT @PollType = PollType
FROM Polls
WHERE PollStatus = 1


    -- Run query depending on PollType

    IF @PollType = 'YN'
    BEGIN
    run query number 1
    END 

    IF @PollType = 'MC'
    BEGIN
    run query number 2
    END

Thanks,
Sebastian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to