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.
| Author |
Topic |
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-07-22 : 02:49:22
|
| I have records of emp id into a CSV file,this file contains records such as (5,15,19,17,............,n)now I have to check all above records are present in emp table or not I know using below query I can find out easily but I wanted to find is there any other ways of doing thismay be like EXIST clauseselect * from empwhere empid in(5,12,19............,n) |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-22 : 03:26:11
|
| select * from firstable t where exists(select 1 from secondtable t1 where t.empid=t1.empid)Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-22 : 03:26:22
|
Import the CSV into a table and then make a query.-- look for empid's that are in CSV but not in emptableselectc.empidfrom CSV_Table cleft join emptable ton t.empid = c.empidwhere t.empid is nullIf that is not what you want then please be more clear. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|