That's pretty much how we've done this when required.
-----Original Message-----
From: Andy and Kim Mills [mailto:[EMAIL PROTECTED]
Sent: 25 June 2004 8:10
To: [EMAIL PROTECTED]
Subject: [ASP] SQL Server Split - Part II
Hello Guys:
I got a Stored Procedure working to do what I wanted, but I have a feeling
it is an amateurish type procedure.
I was wondering if anyone could let me know if this is a pretty good
procedure, or one that needs some improving. I am going to list the
procedure below and would appreciate any help you might be able to provide:
CREATE PROCEDURE dbo.InsertUserApplications
@UserID Integer,
@String Varchar(1000)
AS
DELETE FROM tblUserApplications WHERE UserID = @UserID
DECLARE @AppID Varchar(2)
WHILE LEN(@String) > 0
BEGIN
SET @AppID = LTRIM(SUBSTRING(@String, 0, CHARINDEX(', ', @String)))
SET @String = RIGHT(@String, LEN(@String) - CHARINDEX(', ',
@String))
IF LEN(@AppID) = 0
BEGIN
SET @AppID = LTRIM(@String)
INSERT INTO tblUserApplications(UserID,
ApplicationID)
VALUES (@UserID, @AppID)
BREAK
END
ELSE
INSERT INTO tblUserApplications(UserID, ApplicationID)
VALUES
(@UserID, @AppID)
END
GO
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
The contents of this email and any attachments are sent for the personal attention
of the addressee(s) only and may be confidential. If you are not the intended
addressee, any use, disclosure or copying of this email and any attachments is
unauthorised - please notify the sender by return and delete the message. Any
representations or commitments expressed in this email are subject to contract.
ntl Group Limited
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/