November 5, 2008 at 12:36 am
Hi,
I am passing comma seperated values to SP where i am using IN in the where condition, but its not displaying query results.
Please give me a solution
Thanks,
Prabha
November 5, 2008 at 3:28 am
prabhakaran.ece (11/5/2008)
Hi,I am passing comma seperated values to SP where i am using IN in the where condition, but its not displaying query results.
Please give me a solution
Thanks,
Prabha
Use dynamic queries or let me know the query you are using
kshitij kumar
kshitij@krayknot.com
www.krayknot.com
November 5, 2008 at 3:43 am
Instead of using dynamic SQL, you can transform the list of values ( 'a, b, c, ... ') into a Table, and then make a JOIN.
Something like this:
select f1, f2, f3,
from YourTable,
fn_Transform(@paramListOfValues) as Values
WHERE YourTable.field = Values.field
There are a lot of articles about this idea in this website and in the www.
For example:
http://www.sqlservercentral.com/articles/T-SQL/63003/
You can make searchs with these words:
'Array in SQL'
'Tally Table'
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply