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

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: arsalanayub
Message 6 in Discussion

Here you go Kumar


I have used table variables you can replace them according to ur need , and 
the is a cursor in place too..
I am just sending in the code but if you would like i can send in the 
explanation too.


--------Code Starts Here ----------
Declare @TempStrOdd     VarChar (300)
Declare @TempStrEven    VarChar (300)
Declare @TempStr2       VarChar (300)

Declare @TempFirst Table
(
        Id      Int,
        String  Varchar(300)
)
        Insert Into @TempFirst
                Values (1,'abcdefg')
        Insert Into @TempFirst
                Values (2,'klmnop')
        Insert Into @TempFirst
                Values (3,'uvwxyz')
Select * From @TempFirst
Declare @TempSecond Table
(
        FirstString     VarChar (300),
        SecondString    VarChar (300)
)
Declare @FirstChar      Int
Declare @LastChar       Int


Declare CursorSplit cursor
        For Select String From @TempFirst
Open CursorSplit
Fetch Next From CursorSplit Into @TempStr2

While @@FETCH_STATUS = 0
Begin
        Print (@TempStr2)
        Set @LastChar = Len (@TempStr2)
        Set @TempStrOdd = ''
        Set @TempStrEven = ''
        Set @FirstChar = 1

                While @FirstChar <= @LastChar
                Begin
                        Set @TempStrOdd = @TempStrOdd + SubString( @TempStr2, 
@FirstChar,1)
                        Print (@TempStrOdd + '@FirstChar =  ' + Convert 
(VarChar,@FirstChar) + 
'@LastChar = '+ Convert(VarChar,@LastChar) )
                        --Getting the even values ---------
                        Set @TempStrEven = @TempStrEven + SubString( @TempStr2, 
@FirstChar+1,1)
                        Set @FirstChar = @FirstChar + 2
                End
                Print ( 'The Split data = ' + @TempStrOdd)
                Print ( 'The Split data = ' + @TempStrEven)

                Insert Into @TempSecond
                        Values (@TempStrOdd, @TempStrEven)

        Fetch Next From CursorSplit Into @TempStr2
End
Deallocate CursorSplit
Select * From @TempSecond



--------Code Ends Here ----------



Regards,
Arsalan


>From: "dkumar3016" <[EMAIL PROTECTED]>
>Reply-To: "MumbaiUserGroup" <[email protected]>
>To: [email protected]
>Subject: Problem(how we can do this) breaking strings in first table and 
>store into seco
>Date: Mon, 8 May 2006 09:49:40 -0700
>
>
>
>
>
>
>
>
>
>
>
>
>     New Message on MumbaiUserGroup
>
>
>
>
>
>
>
>       Problem(how we can do this) breaking strings in first table and 
>store into seco
>
>
>
>
>       Reply
>
>
>
>                 
>
>                   Reply to Sender
>                     Recommend
>
>                   Message 1 in Discussion
>
>
>
>
>
>
>
>               From:
>               dkumar3016
>
>
>
>
>
>
>
>
>
>First table
>
>id string
>1 abcdefg
>2 klmnop 
>3 uvwxyz
>
>
>second table
>
>firststring secondstring
>aceg  bdfh
>kmo  lnp 
>uwy  vxz
>
>
>example
>
>In first table
>
>string at id 1 contains
>
>abcdefg  break this string into two parts
>
>at odd places character are aceg store into first string
>at even places character are bdfh store into second string
>store into second table for all values in first table.
>second table is result  for first table.
>
>
> 
>
>
>
>
>
>
>
>     View other groups in this category.
>
>
>
>
>
>
>
>
>
>
>
>
>
>Also on MSN:
>Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily 
>Horoscopes
>
>
>
>
>
>
>
>
>
>
>                   To stop getting this e-mail, or change how often it 
>arrives, go to your E-mail Settings.
>
>
>                                 Need help? If you've forgotten your password, 
> please go 
>to Passport Member Services.
>
>                                 For other questions or feedback, go to our 
> Contact Us 
>page.
>
>
>                                 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.
>
>
>             Remove my e-mail address from MumbaiUserGroup.
>
>
>
>
>
>
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_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