Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server Newbies
»
String Operation in Stored Procedure
String Operation in Stored Procedure
Rate Topic
Display Mode
Topic Options
Author
Message
suresh.kharod
suresh.kharod
Posted Friday, May 22, 2009 12:55 AM
Forum Newbie
Group: General Forum Members
Last Login: Friday, May 22, 2009 12:53 AM
Points: 1,
Visits: 0
I am Passing a String in a Stored Procedure for example
'1,2,3,4,5'
and inside the stored procedure i need to remove the single quotes on the both sides of the string and to store the rest string to a variable inside the Stored Procedure
Can i apply some operation to the string
Post #721857
t.hitendra
t.hitendra
Posted Friday, May 22, 2009 2:47 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, October 17, 2012 10:33 AM
Points: 390,
Visits: 405
Hi there,
you can use replace function which has following syntax
-: replace(@stringvar,charactertoreplace,newcharacter)
for e.g.
DECLARE @HashText nvarchar(10)
set @HashText= '''1,2,3,4'''
declare @grate nvarchar(10)
set @grate=replace(@HashText,'''','')
select @grate
Post #721894
Jack Corbett
Jack Corbett
Posted Friday, May 22, 2009 12:43 PM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 12:22 PM
Points: 10,571,
Visits: 11,871
What are you doing with the string inside the stored procedure? You probably should look into a Split Function that puts the values into a table. Check out
this article
for that.
Jack Corbett
Applications Developer
Don't let the good be the enemy of the best. --
Paul Fleming
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #722324
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.