Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 January 3rd, 2009, 06:01 AM
Authorized User
 
Join Date: Nov 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default To display the banners in sequential manner

I want to display the banners in a sequential manner instead of displaying it randomly.Say for eg if there are 3 records then it should display 1st then 2nd and then 3rd. Following is the stored procedure which displays the banner randomly.But I want it in sequential manner.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[sp_RandomBanner]
as
Declare @rows int
Declare @nRandNum int
create table #TempTable
(
dtPostDate datetime,
vchrLinkURL varchar(100),
vchrImagePath varchar(100),
vchrImageName varchar(50),
vchrStatus varchar(50),
vchrChangeStatus varchar(50),
intBannerID int identity(1,1)
)
INSERT INTO #TempTable
Select dtPostDate, vchrLinkURL, vchrImagePath,vchrImageName,vchrStatus,vchrChangeS tatus From tblBanner where vchrStatus='Running'
select @rows=count(*) from #TempTable
select @nRandNum=Round(((@rows - 1) * Rand() + 1), 0)
select * from #TempTable where intBannerID=@nRandNum and vchrStatus='Running'

Regards,
Jijish





Similar Threads
Thread Thread Starter Forum Replies Last Post
To display the banners in sequential manner jijish SQL Language 3 January 4th, 2009 05:42 PM
sequential transformations alexan XSLT 0 July 24th, 2008 11:59 PM
Chapter 8: User Controls - Shows all banners VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 April 9th, 2008 03:45 PM
HELP!!!!! Sequential DTS e_cabrera_g SQL Server DTS 1 October 11th, 2006 11:54 AM





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