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 |
sunit_82
Starting Member
1 Post |
Posted - 2009-09-01 : 02:46:47
|
Here's the problem definition. There is a table with 2 columns, one is a guid column and second is a nvarchar(20) column. Lets say table has 1000 records. I want to select records from 500 to 600. How to get them using simple select query and not using any store procedures.sunit.s.a.w |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-09-01 : 03:02:23
|
if you are using SQL 2005 / 2008, you can use the row_number() as the record number.select *from( select *, row_no = row_number() over (order by somecol) from yourtable) twhere t.row_no between 500 and 600 KH[spoiler]Time is always against us[/spoiler] |
 |
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-09-01 : 03:03:46
|
SELECT <GuidColumnName>,<2ndColumnname> FROM (SELECT ROW_NUMBER() OVER (ORDER BY <GuidColumnName>) AS sn, * FROM <tableName>)T WHERE sn BETWEEN 500 AND 600Rahul Shinde |
 |
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-09-01 : 03:04:32
|
hmm. KH Got it before meRahul Shinde |
 |
|
|
|
|