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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 doubt rearding passing comma seperated string to IN function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-21 : 08:27:19
satish writes "Hi need to pass comma seperated values(it can be any number of values) from my program to stored procedure which is like this

select * from table A
where searchfield IN (variablepassedfromprogram)

here variablepassedfromprogram contains comma seperated values.
But this wont work.
Any work around for this?????"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-21 : 08:42:54
no there isn't. this is a bug that MS turned into a feature to make our lives miserable.

but seriously, look at:
http://www.sqlteam.com/item.asp?ItemID=11499

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-02-21 : 09:25:08
you can also do:
...
Where ','+@variablePassedFromProgram+',' like '%,'+searchField+',%'

but I think it would be slower than the split/join method.

Corey

"If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain
Go to Top of Page
   

- Advertisement -