By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,105 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,105 IT Pros & Developers. It's quick & easy.

Select query on text field

P: n/a
I want to run a select query on a text field. The text field can contain odd
characters such as inverted commas, colons, semi-colons and slashes.
How can I do this.

SELECT * FROM MYTEXT WHERE MYTXTFIELD = """ & MYSEARCH & """"

If mytextfiled contains inverted commas this doesn't work because the string
does not parse correctly.
I tried doing a REPLACE to replace the odd characters
eg
SELECT * FROM MYTEXT WHERE REPLACE(MYTEXTFIELD,"""","#") = "" &
REPLACE(MYSEARCH,"""","#") & """"
this doesn't work because the replace string does not parse correctly

Alex
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Try SELECT * FROM MYTEXT WHERE MYTXTFIELD = Chr$(34) & MYSEARCH & Chr$(34)

Phil
"Paradigm" <al********@hotmail.com> wrote in message
news:g9***************@newsfe2-gui.ntli.net...
I want to run a select query on a text field. The text field can contain
odd
characters such as inverted commas, colons, semi-colons and slashes.
How can I do this.

SELECT * FROM MYTEXT WHERE MYTXTFIELD = """ & MYSEARCH & """"

If mytextfiled contains inverted commas this doesn't work because the
string
does not parse correctly.
I tried doing a REPLACE to replace the odd characters
eg
SELECT * FROM MYTEXT WHERE REPLACE(MYTEXTFIELD,"""","#") = "" &
REPLACE(MYSEARCH,"""","#") & """"
this doesn't work because the replace string does not parse correctly

Alex

Nov 13 '05 #2

P: n/a
But MYTEXTFIELD contains quotation marks and the string does not parse
Alex

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try SELECT * FROM MYTEXT WHERE MYTXTFIELD = Chr$(34) & MYSEARCH & Chr$(34)

Phil
"Paradigm" <al********@hotmail.com> wrote in message
news:g9***************@newsfe2-gui.ntli.net...
I want to run a select query on a text field. The text field can contain
odd
characters such as inverted commas, colons, semi-colons and slashes.
How can I do this.

SELECT * FROM MYTEXT WHERE MYTXTFIELD = """ & MYSEARCH & """"

If mytextfiled contains inverted commas this doesn't work because the
string
does not parse correctly.
I tried doing a REPLACE to replace the odd characters
eg
SELECT * FROM MYTEXT WHERE REPLACE(MYTEXTFIELD,"""","#") = "" &
REPLACE(MYSEARCH,"""","#") & """"
this doesn't work because the replace string does not parse correctly

Alex


Nov 13 '05 #3

P: n/a
Sorry. I cant see how to do it

Phil
"Paradigm" <al********@hotmail.com> wrote in message
news:NI**************@newsfe5-gui.ntli.net...
But MYTEXTFIELD contains quotation marks and the string does not parse
Alex

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try SELECT * FROM MYTEXT WHERE MYTXTFIELD = Chr$(34) & MYSEARCH &
Chr$(34)

Phil
"Paradigm" <al********@hotmail.com> wrote in message
news:g9***************@newsfe2-gui.ntli.net...
>I want to run a select query on a text field. The text field can contain
>odd
> characters such as inverted commas, colons, semi-colons and slashes.
> How can I do this.
>
> SELECT * FROM MYTEXT WHERE MYTXTFIELD = """ & MYSEARCH & """"
>
> If mytextfiled contains inverted commas this doesn't work because the
> string
> does not parse correctly.
> I tried doing a REPLACE to replace the odd characters
> eg
> SELECT * FROM MYTEXT WHERE REPLACE(MYTEXTFIELD,"""","#") = "" &
> REPLACE(MYSEARCH,"""","#") & """"
> this doesn't work because the replace string does not parse correctly
>
> Alex
>
>



Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.