•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 391,912 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,669 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 3003 | Replies: 1
![]() |
•
•
Join Date: Nov 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
HI all,
I am very new to SQL server and have been working my way through a book to learn ASP.Net v2 and SQL by building a e-commerce site.
There are 3 stored procedures which are used to implement paging from retrieving products from the catalog, which are either on a catalog promotion or a department promotion.
The problem is is that the stored procedure is written in sql 2005 and doesn't work on sql 2000.
I have been trying to change this to sql 2000 but don't have enough experience of sql to do this. can anyone help me with this.
If someone can help me with one of the procedures then i think i should be able to fix the other two.
One of the procedures look like this:
I would really appreciate anybody help that can help me with this. i have really tried but i can't get this right
Thanks in advance
I am very new to SQL server and have been working my way through a book to learn ASP.Net v2 and SQL by building a e-commerce site.
There are 3 stored procedures which are used to implement paging from retrieving products from the catalog, which are either on a catalog promotion or a department promotion.
The problem is is that the stored procedure is written in sql 2005 and doesn't work on sql 2000.
I have been trying to change this to sql 2000 but don't have enough experience of sql to do this. can anyone help me with this.
If someone can help me with one of the procedures then i think i should be able to fix the other two.
One of the procedures look like this:
CREATE PROCEDURE GetProductsOnCatalogPromotion
(@DescriptionLength INT,
@PageNumber INT,
@ProductsPerPage INT,
@HowManyProducts INT OUTPUT)
AS
-- declare a new TABLE variable
DECLARE @Products TABLE
(RowNumber INT,
ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000),
Price MONEY,
Image1FileName VARCHAR(50),
Image2FileName VARCHAR(50),
OnDepartmentPromotion BIT,
OnCatalogPromotion BIT)
-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ROW_NUMBER() OVER (ORDER BY Product.ProductID),
ProductID, Name,
SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description,
Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product
WHERE OnCatalogPromotion = 1
-- return the total number of products using an OUTPUT variable
SELECT @HowManyProducts = COUNT(ProductID) FROM @Products
-- extract the requested page of products
SELECT ProductID, Name, Description, Price, Image1FileName,
Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM @Products
WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage
AND RowNumber <= @PageNumber * @ProductsPerPage
I would really appreciate anybody help that can help me with this. i have really tried but i can't get this right
Thanks in advance
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
There are many different ways of implementing pagin in SQL. We have been using something similar to the following one on the application with few hundred thousand records and it works a treat:
http://www.chapterzero.co.uk/article...ql-server.aspx
Let me know if i can help you with something else.
http://www.chapterzero.co.uk/article...ql-server.aspx
Let me know if i can help you with something else.
Last edited by BalochDude : Oct 4th, 2007 at 12:41 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- Applying SSL certificate to SQL 2000 (MS SQL)
- Coldfusion use SQL 2000 (ColdFusion)
- In which (really) important ways is SQL 2000 better than Access 2003? (MS SQL)
- VB and MS-sql 2000 data navigation (Visual Basic 4 / 5 / 6)
- Ms Sql 2000 (MS SQL)
Other Threads in the MS SQL Forum
- Previous Thread: Create table using recordset
- Next Thread: Complicated SQL SELECT Statement - NEWBIE


Linear Mode