tag:blogger.com,1999:blog-2904192386692843423.post5095049721545624370..comments2024-01-20T18:35:00.592+05:30Comments on IT Developer Zone: Using Variable in "IN" clause in SQL ServerSandeep Mittalhttp://www.blogger.com/profile/02880471130771695348noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-2904192386692843423.post-57813379602803679762013-11-17T12:30:45.538+05:302013-11-17T12:30:45.538+05:30Dear Dog,
The idea here is to explain the problem ...Dear Dog,<br />The idea here is to explain the problem while using variable in "IN" clause.<br />However, if you will go through the post carefully, in the last step it is done the same way you are suggesting and i would also suggest to use the same<br />Thanks.Sandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-34485939912234100042013-11-16T23:12:27.434+05:302013-11-16T23:12:27.434+05:30It shouldn't be done that way. If you have a d...It shouldn't be done that way. If you have a dynamic list to check against, just put it in a table variable and join to that table. Your solutions (well, hacks, not solutions) have many rough edges...Sandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-91531378095210239842013-11-06T02:15:35.341+05:302013-11-06T02:15:35.341+05:30though not efficient but we can use charindex here...though not efficient but we can use charindex here to accomplish the sameSandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-27341105315241520372013-08-02T20:48:20.908+05:302013-08-02T20:48:20.908+05:30and for every DBMS that have not dynamic execution...and for every DBMS that have not dynamic executions, or a bad performance, use:<br />select * from tbldata where instr ('|' || name || '|','|Sandeep||Abhay|') <br /><br />The appended(delimitator) pipe character | can be replaced with a character of your choice.Sandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-62060327260489340632013-04-16T10:21:20.948+05:302013-04-16T10:21:20.948+05:30Thank a lot for the comment .... :)Thank a lot for the comment .... :)Sandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-34227442265751345552013-04-16T09:49:27.410+05:302013-04-16T09:49:27.410+05:30You are genious dude :))You are genious dude :))Rima Gandhihttps://www.blogger.com/profile/13521320414259195290noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-73133844687035126282013-03-25T13:36:52.210+05:302013-03-25T13:36:52.210+05:30Thanks...:)Thanks...:)Sandeep Mittalhttps://www.blogger.com/profile/02880471130771695348noreply@blogger.comtag:blogger.com,1999:blog-2904192386692843423.post-1730017885272159662013-03-25T13:28:51.574+05:302013-03-25T13:28:51.574+05:30nice post :)nice post :)Rima Gandhihttps://www.blogger.com/profile/13521320414259195290noreply@blogger.com