Hi,
It seems to be simple, however, it stumbles me.
how to replace all the double quotes (") within the following
sentence (or a column) with single quotes ('),
colA = this is a freaking "silly" thing to do
into
colA this is a freaking 'silly' thing to do
Select Replace(colA,'"',''') From tblXYZ
won't work,
Select Replace(colA,'"',"'")From tblXYZ
won't work neither.
How come? Thanks. 4 23403
You need to specify 2 single quotes within the literal string when 1 quote
is desired. Try:
Select Replace(colA,'"','''')
From tblXYZ
--
Hope this helps.
Dan Guzman
SQL Server MVP
"NickName" <da****@rock.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com... Hi,
It seems to be simple, however, it stumbles me. how to replace all the double quotes (") within the following sentence (or a column) with single quotes ('),
colA = this is a freaking "silly" thing to do into colA this is a freaking 'silly' thing to do
Select Replace(colA,'"',''')From tblXYZ
won't work,
Select Replace(colA,'"',"'")From tblXYZ
won't work neither.
How come? Thanks.
Thank you very much, Dan, works perfect.
On a related note, BOL does not cover it, how could one find a solution
to a problem similar to this one without resorting to this NG?
I found this from the 'quotation marks' entry in the Books Online index.
From the 'Using char and varchar data' topic:
<Excerpt href="acdata.chm::/ac_8_con_03_7mch.htm">
When using single quotation marks to delimit a character constant that
contains an embedded single quotation mark, use two single quotation marks
to represent the embedded single quotation mark, for example:
SET @MyCharVar = 'O''Leary'
</Excerpt>
--
Hope this helps.
Dan Guzman
SQL Server MVP
"NickName" <da****@rock.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... Thank you very much, Dan, works perfect.
On a related note, BOL does not cover it, how could one find a solution to a problem similar to this one without resorting to this NG?
Man, I can't read, ok, not careful, thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sinister |
last post by:
The examples in the online manual all seem to use double quotes, e.g. at
http://us3.php.net/preg_replace
Why? (The behavior is different with single quotes, and presumably simpler
to...
|
by: Jakanapes |
last post by:
Hi all,
I'm looking for a way to scan a block of text and replace all the
double quotes (") with single quotes (').
I'm using PHP to pull text out of a mySQL table and then feed the text
into...
|
by: Joel |
last post by:
Hi,
I incorporated a function in my code that whenever I use a string variable
in an sql statement if the string contains a single quote it will encase it
in double quotes else single quotes.
...
|
by: deko |
last post by:
I'm trying to log error messages and sometimes (no telling when or where)
the message contains a string with double quotes. Is there a way get the
query to insert the string with the double...
|
by: (PeteCresswell) |
last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time
for SQL searches and DAO.FindFirsts against fields containing same?
I can see maybe wrapping the value searched for...
|
by: Ahmad A. Rahman |
last post by:
Hi all,
I have a problem constructing a regular expression using .net.
I have a string, separated with comma, and I want to group the string
together but, I failed to group a numeric character...
|
by: gar |
last post by:
Hi,
I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code
text= Replace(text, """", "'"
This works fine (for normal double quotes).The problem...
|
by: Charles Law |
last post by:
I have a string similar to the following:
" MyString 40 "Hello world" all "
It contains white space that may be spaces or tabs, or a combination, and I
want to produce an array...
|
by: Justin Fancy |
last post by:
Hi everyone,
I need to replace all instances of a double quote(") with two single
quotes('') in a text file. I already have some replacements of strings
going on, but I tried this one, but the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |