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 2005 Forums
 .NET Inside SQL Server (2005)
 splitting string

Author  Topic 

jaiminsarda
Starting Member

1 Post

Posted - 2008-07-21 : 02:01:11
Hi,
from my c# code, i am passing a string to a stored procedure.
this string has some request ids, separated by a delimiter.
e.g. 100|101|102|103|...

in my stored procedure, i want to take each id one-by-one and delete records from three tables.

Can anybody tell me how do I separate each request id and use it in my stored procedure??

Jaimin

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-21 : 02:02:16
make use of CSVTable or fnParseList
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=CSVTable
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

gregoryagu
Yak Posting Veteran

80 Posts

Posted - 2008-08-11 : 16:21:05
You could use

string mystring = "This,is,a,test";
string[] splitstring = mystring.Split(',');

foreach (string element in splitstring)
{
//Do something with element
}

Greg
Go to Top of Page
   

- Advertisement -