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
 General SQL Server Forums
 New to SQL Server Programming
 please see the query

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-12-12 : 00:30:04
Dear all,
i'm trying to convert the query from in to exists.

am i doing correct?


select * INTO #TMP_TBL1 FROM TABLE16 WHERE COL1 IN
(SELECT COL1 FROM TABLE15 WHERE COL2='code1' AND COL1='code2')

select * INTO #TMP_TBL1 FROM TABLE16 K WHERE EXISTS (SELECT COL1 FROM TABLE15 L WHERE L.COL2='code1' AND
L.COL1='code2' AND K.COL1=L.COL1)


Vinod
Even you learn 1%, Learn it with 100% confidence.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-12 : 00:52:16
Did you get any error?

Madhivanan

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

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-12-12 : 01:09:05
there is no error, but actually in place of code1 and code2, there are id's
the query is from inside a procedure. those should be provided at the time of execution.

that's why i'm asking logically. even in place of * also, some around 20 columns are there

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page
   

- Advertisement -