--
Jay
> -----Original Message-----
> From: Charlie Griefer [mailto:[EMAIL PROTECTED]
> Sent: 20 July 2004 22:42
> To: CF-Talk
> Subject: Re: Retrieve a random record from a database
>
> as a rule, you should try not to pull more records than you
> need. if his table contains a large amount of records, and
> he only needs 1, it's not efficient to pull them all.
>
> since he's using SQL Server, he has the newID() function
> available to him (but be aware that it's SQL Server
> specific...so your app's "portability"
> suffers a bit)
>
> ----- Original Message -----
> From: "Jeff Langevin" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 20, 2004 2:34 PM
> Subject: Re: Retrieve a random record from a database
>
>
> > You could query for all public records and then use
> > randRange(1,myquery.recordcount). That'll give you a
> random row. Then
> > use the primary key to do whatever you need form there. HTH.
> >
> > --Jeff
> >
> > Dustin Snell [Network Automation, Inc] wrote:
> >
> > > We have a database with a bunch of customer testimonials in it.
> > > Records can
> > > be added to it at anytime. Some are marked public and
> some or not. Does
> > > anyone know how I could pull a single record randomly
> from the database
> > > using MSSQL2000 and CF6.1 for display on the website -
> but only out of
> the
> > > records where public=1? I am just not sure how to
> structure the query
> > > to do
> > > this.
> > >
> > > Thanks in advance.
> > >
> > > Dustin Snell
> > > Network Automation, Inc
> > > www.networkautomation.com
> > >
> >
> >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

