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)
 whitout using where clause

Author  Topic 

damuchinni
Starting Member

29 Posts

Posted - 2007-05-22 : 06:14:36
Hi,

is there any laternative to select particular record without using where clause

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-22 : 06:16:41
Yeah. Use cursor and fetch record by record until the record you want.

Seriously, What are you trying to do here ?


KH

Go to Top of Page

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2007-05-22 : 06:35:33
Try something like, not sure they r acceptable


select name, id from sysobjects group by name, id, type
having type = 'p'
-- here we need to specify all the cols in group by

select distinct case when type = 'p' then name else null end
from sysobjects

and lastly self join
Go to Top of Page

damuchinni
Starting Member

29 Posts

Posted - 2007-05-22 : 06:49:31
Hi PeterNeo,

Thank u so much. can u plzz look into the post that i posted "need to calculate number of years".

regards

damodar
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-22 : 07:05:55
quote:
Originally posted by damuchinni

Hi,

is there any laternative to select particular record without using where clause


Is it so difficult to use WHERE clause?
Can you explain what you are trying to do?

Madhivanan

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

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-05-22 : 07:24:40
May be faced this question in interview.....:-)
Go to Top of Page

damuchinni
Starting Member

29 Posts

Posted - 2007-05-22 : 07:49:54
Hi madhivanan,

just look below query

select top 1 * from emp where emp_id=1

that query is ok

bt if at all i want a particular record of emp_id=1 . if each emp_id contains multiple records

then how can i proceed
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-22 : 08:01:07
See if this helps:
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=80669[/url]
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=80073[/url]

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-22 : 10:41:31
Also refer point 2
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx

Otherwise post some sample data and the result you want

Madhivanan

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

- Advertisement -