Dear All,
This may sound a simple query but a non technical person like me is not able to do it, So please help me out.
I m using Unix... isql
I jst wanted to do something like following
select * from xyz
where ID= xxxxxxxx (8 digit ID)
Here if i put single 8 digit ID then the query is returning me the details of that particular ID,... Fine... but instead of selecting single ID if i want to select say 100 specific IDs by providing list of IDs then how do i do it?
My email ID is removed email id
Looking forward for ur appreciable help.
hi
do you want to have those 100 ids only or there could be more than that?
May be you can try this..
Solution(1)
(1) Create a temp table with coln : ID
(2) Copy 100 Ids.
If you are using isql, then BCP 100 ids to temp table
(3) Modify the query
select * from
xyz x,
temp t
where x.ID= t.ID
Solution(2)
(1) Use excel spread sheet & paste the 100 Ids
(2) use spread sheet macro & add "," for each ID
Example:
1000,
1001,
1002, and so on
(3) Use the below query..( paste Ids from spread sheet)
select * from xyz
where ID in (
1000,
1001,
1002, -- paste from spread sheet
...
)
Hope above solution helps
Hey Sathy,
Gr888....Thanx for ur quick reply, I tried last i.e. 3rd solution which is working fine. Also interested in using 1st solution provided by u but not getting how exactly creating a temp table... It would be gr8 help if u explain 1st solution little more.
Thnax.
Here are the steps...
(1) creating temp table:
create table temp ( ID int)
(2) BCP data:
bcp DB-name..temp in text.dat -U<userid> -P<password> -c -eERR.dat
;DB-name: Database name
;text.dat: Should contain 100 IDs
After successful BCP, data will be in temp table
(3) Run the query:
select * from
xyz x,
temp t
where x.ID= t.ID
Hey thanx again for the quick reply.... I tried temp table as well, but some how its not working, may b i m doin somethin wrong... But still i m happy with 2nd n 3rd Solution provided by u...
Thanx once again...
:-) wish u all the best