Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all..

Good afternun..

In my table I have two column in a table named as batchname,process.
bachname contains the 1000 filename,process contains whether the file is completed or not.

My problem is,
I want to select the process column based on 1000 file name.
can anybody provide the query for that?How to pass the 1000 file name to get a process column for the corresponding file?

thanks in advance
Posted
Comments
ssd_coolguy 10-Aug-12 5:42am    
can you explain more with example..
means how batchname contains filenames?
Santhosh Kumar Jayaraman 10-Aug-12 5:44am    
Can you give us one of ur record?
Santhosh Kumar Jayaraman 10-Aug-12 5:51am    
i think single row have 1000 filenames like a,ab,ac,vd,fg...So a sample row will be
Batch name Process
a,ab,ac,vd,fg... Completed
Is that right?

If you know the filenames, you can try something along the lines of:

SQL
SELECT process
FROM table_name
WHERE batchname IN ('batchname1', 'batchname2,', 'batchname3', 'batchname1000');


Now, the problem is that you'll have to come up with a way to put those dynamically in the WHERE clause, writing 1000 file names would be painfully boring (not to mention the fact that they may be 10,000 tomorrow).
 
Share this answer
 
Not sure if I understood your question correctly, but if you have several batch names on a single row (and in a single column) and then a column describing a single process, I think you should change the design of your tables. For example to something like:
Process
- processid, primary key
- name
- status ...

Batch
- processid, foreign key to process
- name ...
 
Share this answer
 
If your table has 1000 rows and you need process information of 1000 batchname, you can simply select all the rows.

Otherwise you could make use of "in" clause. Although this may get messy if you put 1000 values.
 
Share this answer
 
Comments
jai_mca 13-Aug-12 1:23am    
Thanks andrei...thanks to all.i solved the problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900