Monday, March 12, 2012

Limiting Rows in a Report

I am having a table with 100 rows and i want to prepare a report in a
way that each page in the report want to display 10 rows in a page of
the report please say me the procedur for this .
thanks,
baba.If you have SQL 2K5, use ROW_NUMBER. If you're using SQL 2000, do a
self-join on the table. Here's a sample that runs on the Northwind DB:
SELECT COUNT(*) AS RowNumber, c.CustomerID, c.CompanyName, c.ContactName
FROM Customers c, Customers d
WHERE d.CustomerID <= c.CustomerID
GROUP BY c.CustomerID, c.CompanyName, c.ContactName
ORDER BY c.CustomerID
If you put this in a VIEW you can select where RowNumber between 1 and 10 to
grab the first ten; then RowNumber between 11 and 20 to grab the next 10,
etc.
"lucky" <j.v.s.s.baba@.gmail.com> wrote in message
news:1148564830.990338.67400@.j73g2000cwa.googlegroups.com...
>I am having a table with 100 rows and i want to prepare a report in a
> way that each page in the report want to display 10 rows in a page of
> the report please say me the procedur for this .
> thanks,
> baba.
>|||http://www.aspfaq.com/show.asp?id=2120
http://www.aspfaq.com/show.asp?id=2120
"lucky" <j.v.s.s.baba@.gmail.com> wrote in message
news:1148564830.990338.67400@.j73g2000cwa.googlegroups.com...
>I am having a table with 100 rows and i want to prepare a report in a
> way that each page in the report want to display 10 rows in a page of
> the report please say me the procedur for this .
> thanks,
> baba.
>

No comments:

Post a Comment