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

Author  Topic 

jodyford
Starting Member

4 Posts

Posted - 2001-03-28 : 10:47:25
I need help on code that will accomplish the following:

a stored proc that accepts three parameter (primary, secondary, myuser). These parameters are strings seperated by commas (1,2,3) except for the "myuser."

The strings needed to be parsed so that that contents are inserted into the primary and secondary table. Example:

sp_myproc, "Denver, Chicago", "New York, California", myuser

produces:

insert into primary "Denver" where uid=myuser
insert into primary "Chicago" where uid=myuser
insert into secondary "New York" where uid=myuser
insert into secondary "California" where uid=myuser.

There can be a random number of values in the string -except for myuser

Thanks for the help. I know the example does not produce the correct code but I was going for brevity over accuracy in hopes that the audiance would understand where I was trying to go.

thanks in advance!
   

- Advertisement -