467,149 Members | 1,325 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,149 developers. It's quick & easy.

Split Function in Sql stored procedure

Soniad
Hello,

I am new to stored procedure, i am passing one parameter to stored procedure (comma seperated). i want to know how to split this variable inside stored procedure.

Expand|Select|Wrap|Line Numbers
  1. Sample :
  2.  
  3. Exec mystoreproc  '1,2,3,4,5'
i want to split '1,2,3,4,5' in commas and to loop through these numbers.
how to do..???

Regards,
"D"
Jan 24 '09 #1
  • viewed: 8792
Share:
4 Replies
ck9663
Expert 2GB
Depends on what you're going to do with it. What do you have so far?


-- CK
Jan 24 '09 #2
Soniad
@ck9663
I want to split these numbers (1,2,3,4,5) and want to insert this id one by one in a table. if it was in vbscript or javascript i wud have done it..but don't have any idea how to do in stored procedure..the only idea i have is that by using CHARINDEX it cud be done.but how??
any suggestion please..


Regards,
"D"
Jan 25 '09 #3
ck9663
Expert 2GB
Use this technique.


-- CK
Jan 25 '09 #4
Soniad
@ck9663
Thanks for ur assistance.

Regards,

"D"
Jan 31 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Bob Murdoch | last post: by
20 posts views Thread by Tom van Stiphout | last post: by
6 posts views Thread by yamu_rhyme@yahoo.co.in | last post: by
12 posts views Thread by Steve Blinkhorn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.