Home All Groups Group Topic Archive Search About

Is there a function can convert a comma delimited string to int se

Author
21 Jul 2006 2:27 PM
NeilB
This 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!

Author
21 Jul 2006 2:33 PM
Omnibuzz
Author
21 Jul 2006 2:38 PM
NeilB
Exactly what i need, thank you!
Author
21 Jul 2006 2:34 PM
Tracy McKibben
NeilB wrote:
Show quote
> This 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!

http://realsqlguy.com/twiki/bin/view/RealSQLGuy/ParseDelimitedStringToTable


--
Tracy McKibben
MCDBA
http://www.realsqlguy.com

AddThis Social Bookmark Button