Agreed! I was recently doing some convoluted steaming pile of code - asp and sql - to determine a random record to display.
The code is a *lot* neater now that I've implemented David's solution. This post has no point - I just get excited optimising... ----- Original Message ----- From: "Bear" <[EMAIL PROTECTED]> To: "ActiveServerPages" <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 1:29 AM Subject: RE: Random picture from a Database : : Andy, I've done this/seen it done a few different ways over the years. : Most solutions required at least 15 lines of ASP code and often two, : occasionally more, trips to the database. I'm looking forward to using : David Penton's one-line SQL query (posted for you again yesterday) the : next time we need to do this job... it is almost certainly faster and : easier than anything else you might do. : : Note that David's is not ordered by Rand, but by NewID(). : : HTH : : -----Original Message----- : From: Andy Hayman [mailto:[EMAIL PROTECTED]] : Sent: Wednesday, September 25, 2002 11:00 AM : To: ActiveServerPages : Subject: RE: Random picture from a Database : : : > And then you have the SQL approach, where you do a select top : > 1 ... order by Rand. : > : > HTH, : > Tore. : : Order By Rand : : Is rand a command or are you putting that to represent a generated : coloum, if this is the case it wont be very random surely? : : Andy : : --- : You are currently subscribed to activeserverpages as: : [EMAIL PROTECTED] To unsubscribe send a blank email to : %%email.unsub%% : : : : --- : You are currently subscribed to activeserverpages as: [EMAIL PROTECTED] : To unsubscribe send a blank email to %%email.unsub%% : --- You are currently subscribed to activeserverpages as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
