It basically populates the entire resultset with a newid(), sorts by the newid() then gives you the TOP 1. Not good for a million+ record table.
David L. Penton, Microsoft MVP JCPenney Technical Specialist / Lead "Mathematics is music for the mind, and Music is Mathematics for the Soul. - J.S. Bach" [EMAIL PROTECTED] Do you have the VBScript Docs or SQL BOL installed? If not, why not? VBScript Docs: http://www.davidpenton.com/vbscript SQL BOL: http://www.davidpenton.com/sqlbol -----Original Message----- From: Nick Middleweek [mailto:[EMAIL PROTECTED]] David (or anyone), It does work but... How does this actually work? Thanks, Nick :> -----Original Message----- :> Nick, :> :> Are you using SQL Server? SELECT TOP 1 col FROM tbl ORDER BY :> NEWID() should :> do the trick. --- You are currently subscribed to activeserverpages as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
