Heh, you are right. A lot of the 'fancy' stuff in SQL is right out of BASIC
BASIC (anybody remember that book?). Ya got your DO loop, yer IF..THEN
clause, all that kind of stuff.

The fact is, you can do some amazing stuff with SQL, and port a lot of
business logic to the database end of things. I don't know about you folks,
but I've got folks who want to connect to the DB backend directly with
things like Access; and some of these folks I can't say "No" to. The only
way to keep these folks in line is to integrate a lot of business logic on
the DB end, in the form of permissions, rules, setting up different foreign
key relationships, and what-not.

I do believe we're all gonna see things moving in this direction, where a
database is seen as a resource, and our mighty Fusebox web apps are merely
one of many users of that resource.

Alan McCollough
Web Programmer
Allaire Certified ColdFusion Developer
Alaska Native Medical Center

> -----Original Message-----
> From: Janty.com Development [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, December 12, 2000 5:55 PM
> To:   Fusebox
> Subject:      Re: Random record?
> 
> Heh .. this reminds me of the classic example of how to generate a random
> number from the good Ol' days of coding in BASIC ... in fact it's, more or
> less, the same syntax.  Leave it to MS to, um .. 'innovate' hehe
> 
> Todd Ashworth
> 
> ----- Original Message -----
> From: "Michael 'Maxx' Porter" <[EMAIL PROTECTED]>
> To: "Fusebox" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 12, 2000 7:57 PM
> Subject: RE: Random record?
> 
> 
> > That is a beautiful piece of code.  I have to do this for a site next
> > week..saved my weekend thanks.
> >
> >
> > At 11:08 AM 12/12/00 -0900, you wrote:
> > >declare @rand_id int
> > >while @rand_id is null
> > >BEGIN
> > >set @rand_id = (select id
> > >from table
> > >where id = rand() * (select max(id) from table) + 1)
> > >END
> > >select * from table where id = @rand_id
> 
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        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