C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Breaking a string in a store procedure


Posted Date: 30 Jun 2008    Resource Type: Articles    Category: General
Author: Gursimran SinghMember Level: Bronze    
Rating: Points: 7



Suppose the company ids are coming in a string name @COMPANY_ID

BEGIN
DECLARE @CID VARCHAR(70)
DECLARE @Id varchar(max)
declare @Idd varchar(255)
declare @PN varchar(255)
declare @PNN varchar(255)
SET @CID = CONVERT(VARCHAR,@COMPANY_ID)
SET @PNN=''
Declare @CommaIndex varchar(10)
set @Idd=@search_key+','
While( @Idd <> '' or @Idd <> null )
BEGIN
SELECT @CommaIndex = PATINDEX('%,%', @Idd)
Select @PN = Substring(@Idd,1,@CommaIndex-1)
set @PN=+ ''''+ ''+ @PN +'' +''''+','
set @PNN=@PNN+@PN
Select @Idd = Substring(@Idd,PATINDEX('%,%', @Idd)+1
,len(@Idd))
if(@Idd is null)
begin
break
end




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: OOPs Concepts in C#
Previous Resource: Template Method Design Pattern - C#
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use