April 25, 2006 at 3:02 pm
OK, is there anyone out there that has a cheat sheet for how/when to use single/double quotes to embed a comma or an apostrophe?? I need to have a comma in a disclaimer at the bottom of my report and since my delimeter is a comma, it lays out funky in the report. I need to use single/double quotes to embed it and I can't figure it out!! I need a cheat sheet!!! Help, and thank you in advance!!! ![]()
April 25, 2006 at 6:27 pm
Hi...Do you mean this...
select ''','''
..run this is Query analyser..
hope this helps
Riyaz
April 25, 2006 at 9:02 pm
I believe it was Sean (McCown) who wrote a neat article on using char(39) for single quotes (search this site)...
based on that you could do a ...
select char(39) + char(44) + char(39)
**ASCII stupid question, get a stupid ANSI !!!**
April 26, 2006 at 8:56 am
Thank you to both of you for your responses. This report is comma delimeted and is going into an excel spreadsheet. What I found yesterday, is that if I do the folllowing and wrap it in a double quote, inside the single quote, it works, but I still need to understand the whole concept of using the single/double quotes. So, with that said, you can see how this will work, and I am off to learn how to use what you both gave me!! Thanks again!!!!
Set @sPrintString = '"Thank you!"'
April 26, 2006 at 2:02 pm
Haven't read that article, but I have CHAR(39) memorized for precisely this sitiuation! ![]()
I wasn't born stupid - I had to study.
April 26, 2006 at 2:48 pm
Thanks Farrell. I contacted Sean and he sent me the link to the article.
http://www.sqlservercentral.com/columnists/sMcCown/getawayfromconfusingcode.asp
You will love the little script he has at the bottom...I have it saved off for future use!! More more more char()'s for you to memorize!!! ![]()
April 28, 2006 at 2:56 am
And why you are not changing the column delimiter to other character then a comma? like ; or TAB or | or what ever? You should choose such a char which is not likely appairing within your data
Bye
Gabor
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply