March 23, 2009 at 9:11 am
Hi all,
Can anyone help me with how to use ASCII code in a stored procedure for double quote. I want to get read of (") in my stored procedure by using ASCII code relevant to double quote.
Thanks in advance...
March 23, 2009 at 9:17 am
There's an "ASCII()" function that will generate any given ASCII character. Just put the number in it.
You can get the numbers from Wikipedia. Just Google "ASCII" and it comes up straight away.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 23, 2009 at 9:23 am
ok can you help me with this one, this line is a part of my stored proc.. how do I remove " in front of XYZ and use ASCII code. I basically want to get read of double quotes as it is creating problem with my dynamic sql execution.
SELECT ' '
March 23, 2009 at 9:24 am
SELECT ' '
March 23, 2009 at 9:24 am
I would need to see your code to know what to suggest.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 23, 2009 at 9:26 am
select '<MESSAGE type = "XYZ" Content ="XYZ"
Type="Response" Frame="0" Last="1"> '
This is one line which includes double quotes...
March 23, 2009 at 9:35 am
I can't tell just from that what it's trying to do. Are you executing that as a command?
Are you getting an error message? If so, what?
It would be very helpful if you posted the whole section of code that's causing the problem. Otherwise, I'm kind of shooting in the dark here.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 23, 2009 at 9:38 am
You do not need to use ASCII code.
This should work.
SELECT REPLACE(' ', '"', '')
In case it does not work for you adn you need the ASCII
SELECT REPLACE(' ', CHAR(34), '')
The question is, are you sure you want to do this? Based on your example if you remove the doube quotes the string you get back just does not make sense anymore.
---------------------------------------------
[font="Verdana"]Nothing is impossible.
It is just a matter of time and money.[/font]
March 23, 2009 at 9:42 am
Crap, forgot about the HTML tags eating the code.:angry:
SELECT REPLACE('<MESSAGE type = "XYZ" Content ="XYZ"
Type="Response" Frame="0" Last="1"> ', '"', '')
SELECT REPLACE('<MESSAGE type = "XYZ" Content ="XYZ"
Type="Response" Frame="0" Last="1"> ', CHAR(34), '')
---------------------------------------------
[font="Verdana"]Nothing is impossible.
It is just a matter of time and money.[/font]
March 23, 2009 at 10:27 am
It worked Thanks a lot...
March 23, 2009 at 10:56 am
Next time you need the ASCII code just run something like this:
SELECT ASCII(code_searched)
Example:
SELECT ASCII('"')
---------------------------------------------
[font="Verdana"]Nothing is impossible.
It is just a matter of time and money.[/font]
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply