-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: BalajiKrishnan
Message 1 in Discussion

hi srinivas,   Can you check this logic.........   
-----------------------------------------------------------------------------   
DECLARE @Length INT
DECLARE @strCODE VARCHAR(50)
DECLARE @STR VARCHAR(200)
set @STR = '45,56_66,44_55'
SELECT @Length = DATALENGTH(@STR)   
 
    
 WHILE @Length > 0    
  BEGIN    
      EXECUTE @Length = sp_popmodifiers @STR OUTPUT, @strCODE OUTPUT    
      IF @Length > 0    
        BEGIN    
                 select    @strCODE = ltrim(rtrim(@strCODE)) 
        END
 END  
-------------------------------------------------------------------------------------------------
   
ALTER PROCEDURE sp_popmodifiers  
    @SourceString   NVARCHAR(4000) = NULL OUTPUT,  
    @FirstWord      NVARCHAR(4000) = NULL OUTPUT  
AS  
    SET NOCOUNT ON  
    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  
------------------------------------------------
   Actually my requirement is when i pass the value(44,55_66,56_67) to this STORED 
PROCEDURE sp_popmodifiers     the stored procedure should return  44,55 66,56 67   
keeping _ (underscore) as the delimiter...............................   There is no 
limitation in passing the parameters but it will be seperated with the delimiter 
(underscore) say for example 44,55_55,66_66_77_66   i had return the logic......can 
you check it.....   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]

Reply via email to