Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2006-10-09 : 04:10:59
|
hi friends,i need a query to display the rows from 2 to 5 records.suppose i have 100 records in my table.i need records from 2 to 5 only.thanks in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-09 : 04:19:59
|
How do you determine row/record order?Peter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-10-09 : 04:36:12
|
Refer this article, point # 13:[url]http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx[/url]Harsh AthalyeIndia."Nothing is Impossible" |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-10-09 : 05:47:52
|
If you have primary key in your table, then have a look at the following script SELECT (SELECT COUNT(i.au_id) FROM pubs..authors i WHERE i.au_id >= o.au_id ) AS RowID, au_fname + ' ' + au_lname AS 'Author name'FROM pubs..authors oORDER BY RowID This will generate the RowId and then accordingly you can select the rows which you want sepcifying the range in the where clause. if you are using SQL Server 2005 then have a look at following link.http://www.sqlservercentral.com/columnists/mcoles/sequentialordering.aspChiraghttp://chirikworld.blogspot.com/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|