Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
LinkedIn
Online Members
More...
Join our online
Google+ community
for Bloggers, Content Writers and Webmasters
Resources
»
.NET programming
»
General
Breaking a string in a store procedure
Posted Date:
30-Jun-2008
Category:
General
Author:
Gursimran Singh
Member Level:
Bronze
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
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "Breaking a string in a store procedure"
No responses found. Be the first to respond...
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
OOPs Concepts in C#
Previous Resource:
Template Method Design Pattern - C#
Return to Resources
Post New Resource
Category:
General
Post resources and
earn money
!
More Resources
OOPs Concepts in C#
COMPUTER VIRUSES
Adding elements to an ArrayList with AddRange in C#
Team Foundation Server In Brief
New features in the SQL for the COMMING Future
Convert Currency to English Words
Popular Tags
Tag posting guidelines
Search Tags
(No tags found.)
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Jivani
(23)
naveensanagase...
(21)
Padma
(10)
Last 7 Days
baskar
(297)
Ultimaterengan
(267)
Rakesh Chaubey
(184)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
Revenue Sharing sites
Advertise
Talk to
Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.