Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2003, 08:45 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generate a random article when page loads

Everytime the page loads a new article is supposed to appear and rotate through randomly all the articles in the new magazine(id=13) But it keeps brining up magazine 11. The code is in place but it dosen't seem to work anymore. The site is
http://www.ocean-resources.com/ and under current issue of Ocean Resources is suppose to be the articles from mag 13 and not 11. The code looks good, but I can't figure it out. Is there a program to use like(interdev) to see what value "magId" is holding so I can see where it goes wrong.

Thanks, Jamie

__________________
-----------------------------------------------------------
\"Don\'t follow someone who\'s not going anywhere\" John Mason
 
Old October 28th, 2003, 10:45 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can use something like:

SELECT Min(Field1) as NewField1
FROM Table1
ORDER BY NEWID()

NEWID() creates a new numeric ID, something like a new auto number within the query. Then you select the max value of it.

Hope this helps.



Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to generate random numbers in xslt anboss XSLT 3 July 23rd, 2008 09:10 AM
How to generate 12 random questions curiaquita VB.NET 3 April 12th, 2008 03:01 PM
generate Random number in MS SQL server 2000 nax111 SQL Server 2000 9 March 29th, 2007 10:14 PM
how to generate random non repeated numbers in php method PHP How-To 0 February 6th, 2006 02:36 PM
Random News Topic when the page loads morpheus Classic ASP Databases 4 November 21st, 2003 01:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.