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 2005 Forums
 Transact-SQL (2005)
 Dynamic IN clause

Author  Topic 

lavani
Starting Member

2 Posts

Posted - 2009-04-29 : 01:56:24
Hi, i have a table "LOOKUP". i want to query this table using a dynamic IN clause like below
Select name_cd,rank from LOOKUP where rank =(select min(rank) from LOOKUP where name_cd IN('A','B').

My question is, instead of 'A' and 'B' i have to use variables dynamically from my program which used DCLGEN variables.

how do i fetch my rows now?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-04-29 : 02:07:32
Are you using SQL Server 2005 or DB2 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

lavani
Starting Member

2 Posts

Posted - 2009-04-29 : 02:11:38
Am using DB2
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-04-29 : 02:18:29
you do notice that this is a Microsoft SQL Server forum right ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-04-29 : 02:49:01
Try at www.dbforums.com

Madhivanan

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

- Advertisement -