-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: BalajiKrishnan
Message 2 in Discussion
Srinivas, This code works fine...... DECLARE @Length INT
DECLARE @strCODE VARCHAR(50)
DECLARE @STR VARCHAR(200)
set @STR = '45,56_66,44_55_66_77_78,66,77'
SELECT @Length = DATALENGTH(@STR)
--Print @Length
WHILE @Length > 0
BEGIN
EXECUTE @Length = sp_popmodifiers @STR OUTPUT, @strCODE OUTPUT
IF @Length > 0
BEGIN
select @strCODE = ltrim(rtrim(@strCODE))
print @strCODE
END
END ALTER PROCEDURE sp_popmodifiers
@SourceString NVARCHAR(4000) = NULL OUTPUT,
@FirstWord NVARCHAR(4000) = NULL OUTPUT
AS
SET NOCOUNT ON
-- Procedure accepts a colan ':' delimited string as the first parameter
-- Procedure outputs the first word in the second parameter
-- Procedure outputs the remainder of the delimeted string in the first parameter
-- Procedure yields the length of the First Word as the return value
DECLARE @Oldword NVARCHAR(4000)
DECLARE @Length INT
DECLARE @CommaLocation INT
SELECT @Oldword = @SourceString
IF NOT @Oldword IS NULL
BEGIN
SELECT @CommaLocation = CHARINDEX('_',@Oldword)
SELECT @Length = DATALENGTH(@Oldword)
IF @CommaLocation = 0
BEGIN
SELECT @FirstWord = @Oldword
SELECT @SourceString = NULL
RETURN @Length
END
SELECT @FirstWord = SUBSTRING(@Oldword, 1, @CommaLocation -1)
SELECT @SourceString = SUBSTRING(@Oldword, @CommaLocation + 1, @Length -
@CommaLocation)
--select @FirstWord as aa,@SourceString as bb
RETURN @Length - @CommaLocation
END
RETURN 0
------------------------------------------------ thanks Balaji
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]