> Is there a way to perform a random fetch using a cursor?

This is what I did, but I'm a CF guy, not a DBA, so I can't vouch for how
"right" it is. (It does seem to work, however.:)

<cfset WhichBit = RandRange(1,Application.TotalInfobits)>
<cfquery name="GetInfobit" datasource="#dsn#">
        -- Declare the cursor.
        DECLARE infobits_cursor SCROLL CURSOR FOR
                SELECT * from dd_infobits
                        where infobitType like 'quote'
        OPEN infobits_cursor
        -- Fetch the chosen row in the cursor.
        FETCH ABSOLUTE #WhichBit# FROM infobits_cursor
        CLOSE infobits_cursor
        DEALLOCATE infobits_cursor
</cfquery>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        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