escape sequence

escape sequence

Post by Phillip Hause » Wed, 10 Jul 2002 18:41:53



Hi!

update table set message='"hi"' where...

Since there are " in my message this query doesn't work. For MySQL is simply
used the following query:

update table set message='\034hi\034' where...

Can anybody help me?
Thanks, Phillip

 
 
 

escape sequence

Post by Tibor Karasz » Wed, 10 Jul 2002 19:05:49


Philip,

First, I strongly recommend that you enclose strings with single quotes and not double quotes.
Anyhow, the character that you enclose the string in has to be doubles. Like:

SELECT 'Sue''s car'

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...


Quote:> Hi!

> update table set message='"hi"' where...

> Since there are " in my message this query doesn't work. For MySQL is simply
> used the following query:

> update table set message='\034hi\034' where...

> Can anybody help me?
> Thanks, Phillip


 
 
 

escape sequence

Post by Phillip Hause » Wed, 10 Jul 2002 19:52:58


Then the following statement should work, shouldn't it?

insert into table set variable='Hi ""Phillip""'



Quote:> Philip,

> First, I strongly recommend that you enclose strings with single quotes

and not double quotes.
Quote:> Anyhow, the character that you enclose the string in has to be doubles.
Like:

> SELECT 'Sue''s car'

> --
> Tibor Karaszi, SQL Server MVP
> Archive at:

http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...



> > Hi!

> > update table set message='"hi"' where...

> > Since there are " in my message this query doesn't work. For MySQL is
simply
> > used the following query:

> > update table set message='\034hi\034' where...

> > Can anybody help me?
> > Thanks, Phillip

 
 
 

escape sequence

Post by Tibor Karasz » Wed, 10 Jul 2002 20:15:28


No. Only double the same quotes as you enclose the string in.

Quote:> insert into table set variable='Hi ""Phillip""'

Since you enclosed the strings in single quotes, you should not double up the double-quotes. Try
below:
select 'Hi ""Phillip""'
select 'Hi "Phillip"'

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...


> Then the following statement should work, shouldn't it?

> insert into table set variable='Hi ""Phillip""'



> > Philip,

> > First, I strongly recommend that you enclose strings with single quotes
> and not double quotes.
> > Anyhow, the character that you enclose the string in has to be doubles.
> Like:

> > SELECT 'Sue''s car'

> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at:
> http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...



> > > Hi!

> > > update table set message='"hi"' where...

> > > Since there are " in my message this query doesn't work. For MySQL is
> simply
> > > used the following query:

> > > update table set message='\034hi\034' where...

> > > Can anybody help me?
> > > Thanks, Phillip

 
 
 

1. escape sequence for varchar

I need to insert text into a SQL Server Database and quite
often a single quote will be encountered such as
O'Reilly.  The insert fails at this point.  I was told to
use an escape sequence to overcome this but I am not
familiar with this process.  Can anyone help???

Thanks,

Robert

2. OLE-Object

3. Printer Escape Sequences

4. Report which only uses last line table

5. How does JDBC escape sequence work?

6. Java and D3

7. jdbc escape sequences

8. vb.net question

9. ODBC escape sequence

10. Escape sequence for return in a MEMO field

11. Escape sequences in SQL*Loader

12. ODBC Escape Sequence

13. Escape sequences lost printing thru NT