![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to store the data retrived by a select query into variables? | jisha | Shell Programming and Scripting | 12 | 01-17-2008 08:45 PM |
| Doubt regarding Select() | sunil_ktg | UNIX for Advanced & Expert Users | 2 | 12-15-2007 04:46 AM |
| Displaying the data from the select query in a particular format | sachin.tendulka | Shell Programming and Scripting | 15 | 12-11-2007 05:44 AM |
| Select a portion of file based on query | vanand420 | Shell Programming and Scripting | 14 | 10-31-2006 01:48 AM |
| how to select a value randomly | norsk hedensk | Shell Programming and Scripting | 1 | 10-28-2003 02:39 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help (Select query)
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. :-) Last edited by vino; 02-11-2008 at 11:01 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
hi
do you want to have those 100 ids only or there could be more than that? |
|
#3
|
|||
|
|||
|
Try this..
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 |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
Info...as requested
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 |
|
#6
|
|||
|
|||
|
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... :-) |
|||
| Google The UNIX and Linux Forums |