Sorry, I messed up the instr function ( I don't think it's supported in
SQL2K)  I think you can use the charindex function instead.  Also make
sure to add an ending comma like Issac suggested.

Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy 
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com

-----Original Message-----
From: Matthew Small [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 22, 2003 3:42 PM
To: CF-Talk
Subject: RE: string parsing or list traversal

I don't see why you'd have any problems doing this:

Try something like this:

Create procedure insert_list @list nvarchar(500) as
        declare @item nvarchar (50);
        While len(@list) > 0
        begin
                set @item = left(@list,len(instr(@list,','))
                insert into tablename (field1) values (@item);
                set @list = right(@list,len(@list)-len(@item))
        end
return

I haven't tried this but something like it will work.

Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy 
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com

-----Original Message-----
From: Tangorre, Michael [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 22, 2003 3:23 PM
To: CF-Talk
Subject: RE: string parsing or list traversal

:-)

wish i was on sql2K, but still on 7.0

Mike

-----Original Message-----
From: Lomvardias Christopher
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 3:14 PM
To: CF-Talk
Subject: RE: string parsing or list traversal


One option would to be use a UDF (SQL2K).


http://www.sqlteam.com/item.asp?ItemID=11499

Chris

-----Original Message-----
From: Tangorre, Michael [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 2:52 PM
To: CF-Talk
Subject: string parsing or list traversal


Does anyone know how to traverse a list of prse a string in T-SQL inside
a
stored procedure?
What I need to do i send a comma delimited list into a stored proc then
loop
over the list inserting each entry into a table.
 
Any help would be appreciated.
 
Thanks,
 
Michael T. Tangorre
 
----------------------------------------
MillenniuM Information Systems
1101 Wilson Blvd. Suite 1200
Arlington, Virginia 22209
 
O: 703-341-1438
C: 607-426-9277
----------------------------------------
Golden Rule: 
"He who has the gold, makes the rules!"
 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to