Link to home
Start Free TrialLog in
Avatar of ivanovn
ivanovnFlag for United States of America

asked on

Text field comparison involving new line characters

I have a text field that stores a chunk of text that contains some new lines as well. I am unable to do a succesful comparison of that field with provided string.

For example I have the following situation:

CREATE TABLE table1
(
  id int4 NOT NULL,
  message text,
);

In that table there is a record where:
id=1
message=SPECIAL WEATHER STATEMENT
NATIONAL WEATHER SERVICE BLACKSBURG VA
436 AM EDT FRI APR 14 2006
NCZ001>006-018>020-VAZ007-009>020-022>024-032>035-043>047-058-059-
WVZ042>045-141600

I want to find all the ids that have that particular message. So I execute the following query:

SELECT id FROM table1 WHERE message = 'SPECIAL WEATHER STATEMENT
NATIONAL WEATHER SERVICE BLACKSBURG VA
436 AM EDT FRI APR 14 2006
NCZ001>006-018>020-VAZ007-009>020-022>024-032>035-043>047-058-059-
WVZ042>045-141600'

However this returns no records. Why is this the case, and how should I compare this message to get a match on the id?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of m1tk4
m1tk4
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial