|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is there a function can convert a comma delimited string to int seThis might be a stupid question, i got a string "20,30,40", I want to use the
string in the following SQL stmt: @user_id_list VARCHAR(400) .... -- now @user_id_list is "20,30,40" .... SELECT user_id from user_table where user_id IN ( a_magic_function(@user_id_list) ) Is there such a magic function can do that? Thanks! for sql 2000 check this
http://www.sommarskog.se/arrays-in-sql.html for 2005 check the third query in this.. http://omnibuzz-sql.blogspot.com/2006/06/interesting-queries-using-recursive.html Hope this helps. NeilB wrote:
Show quote > This might be a stupid question, i got a string "20,30,40", I want to use the http://realsqlguy.com/twiki/bin/view/RealSQLGuy/ParseDelimitedStringToTable> string in the following SQL stmt: > > @user_id_list VARCHAR(400) > ... > -- now @user_id_list is "20,30,40" > ... > > SELECT user_id from user_table where user_id IN ( > a_magic_function(@user_id_list) ) > > Is there such a magic function can do that? > > Thanks! |
|||||||||||||||||||||||