May 22, 2009 at 12:55 am
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
May 22, 2009 at 2:47 am
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
May 22, 2009 at 12:43 pm
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[/url] for that.
Jack Corbett
Consultant - Straight Path Solutions
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
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply