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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 show certain records

Author  Topic 

gannamalai
Starting Member

1 Post

Posted - 2006-12-14 : 06:10:39
hai friends,

i have a table called emp having 10 records.

i want to display only 3rd,4th and 5th records only.

there is no rowid,no primary key.

please help me.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-14 : 06:17:59
What is the criteria for defining 3rd, 4th and 5th record?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-14 : 06:21:03
select * from <yourtablenamehere>
where row_number() over (order by <somecolumnnamehere> between 3 and 5


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-14 : 10:05:12

1 You cant do it directly
2 Define those 3rd, 4th and 5th records
3 Copy data to temp table that has identity column, then find records based on id
4 If you use SQL Server 2005, it is very easy as suggested above
5 This is really souds an Interview question

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -