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)
 Spliiting a string

Author  Topic 

dovesdale
Starting Member

11 Posts

Posted - 2007-06-26 : 05:32:22
My front end is asp.net.From my webpage i am selecting a number of values in a checkbox list.those values should be saved in database.for doing this i wrote a loop in front end and on each iteration i call the storedprocedure to insert.I need to know whether it is a good prcatice.

Now my question is how would u do this in back end.If i pass all the selected values as a string to the store procedure,can i split in the storeprocedure and insert with a loop in storeprocedure.

eg @custID=1|2|5|7|....etc
i need to insert a row where custID=1 ,custID=2

Kristen
Test

22859 Posts

Posted - 2007-06-26 : 05:37:31
See: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=CSV,Splitting%20delimited%20lists,Best%20split%20functions
Go to Top of Page

dovesdale
Starting Member

11 Posts

Posted - 2007-06-26 : 06:52:21
can sombody be more precise
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2007-06-26 : 08:43:55
@CcustID varchar(30)
insert into tbl_coustomer values(',' + @StudentId + ',' Like '%,' + cast(M.StudentId as varchar(30))+ ',%')


One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-26 : 08:54:33

http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-26 : 08:55:24
quote:
Originally posted by dovesdale

can sombody be more precise

Did you test the link posted by Test?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-06-26 : 10:06:49
"can sombody be more precise"

Which part of the link that I posted do you need help with?

Kristen
Go to Top of Page
   

- Advertisement -