Link to home
Start Free TrialLog in
Avatar of Kaporch
Kaporch

asked on

SQL Server 2000- new line/return character appearing as square boxes

I'm trying to do a comparison between a field in the database and a field on my data entry form.  It contains some new line and return characters.  In the text box, those characters are appearing as /n and /r, but in the database, they're being stored as what appears to be boxes.  Does anybody know how to do the comparison for these characters?  The field is being stored as varchar(8000).
Avatar of TWBit
TWBit
Flag of United States of America image

Look for ascii values of 10 and 13, respectively
In SQL Server, they are stored as CHAR(10) and CHAR(13).
For comparison, you could probably do something like
IF REPLACE(dbColumn, CHAR(10)+CHAR(13),'') = REPLACE(txtString, '/n/r', '')
    BEGIN
        ... -- code if equal
    END
ELSE
    BEGIN
        ... -- code if unequal
    END
Avatar of Kaporch
Kaporch

ASKER

The replace didn't work.  They're still computing as not being equal.
SOLUTION
Avatar of D B
D B
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
ASKER CERTIFIED SOLUTION
Avatar of Zberteoc
Zberteoc
Flag of Canada 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
Can you post the contents of the db field and the form field so we can see what should be considered equal?