Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problems reading data from a database

Author  Topic 

Apples
Posting Yak Master

146 Posts

Posted - 2008-03-24 : 11:40:53
I have a database that contains news items. There's a column that contains the actual article. In that field, there are paragraphs with page breaks. The page breaks in the database are represented as squares (unrecognizable characters I guess). When I try to read in the data, it doesn't recognize the page breaks, and it comes out all in one large paragraph. Is there any way to get around this?

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-03-24 : 13:29:25
Try the search and replace Chr(12) (ascii code) for page break


Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-03-24 : 13:34:00
One solution is to:

First identify the character(s). You can use something like winVI to see the character codes or from within sql you can use SUBSTRING to isolate the character and us ASCII to examine the code of that character.

ie this identifies the ascii code of the <space>:
select ascii(substring('abcde fgh', 6, 1)) --32

When you know what characters they are you can use REPLACE to exchange them for something more friendly when you INSERT or UPDATE the values - or you can leave them in there and do the REPLACE when you SELECT the values out.

Another possibility is change the process that generated the data in the first place.


EDIT:
If the column is nvarchar or ntext you should use UNICODE rather than ASCII.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -