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