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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Exporting text from a TEXT datatype )

Author  Topic 

heygee
Starting Member

27 Posts

Posted - 2005-07-21 : 11:51:42
All,

I am trying to export some data from a table which contains a column of type TEXT. This field contains a string of text containing carriage returns/line feeds. How can I export the text without these types, or is there a way of removing them so all the text exported is on one line?

Many thanks,
Gee

Gee

"Happiness is a good health and a bad memory!"

stephe40
Posting Yak Master

218 Posts

Posted - 2005-07-21 : 16:11:25
You can use the replace function in the query that pulls out the data.

replace(replace(yourfield, char(10), ''), char(13), '')


- Eric
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-22 : 02:08:46
I think you cannot use text datatype field in replace function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

heygee
Starting Member

27 Posts

Posted - 2005-07-22 : 04:29:10
Easy when you know how! I must have been half asleep when thinking about this yesterday, but have changed stephe40's code to the following to get it to work:

select replace(replace(cast(MyField as char(1000)), char(10), ''), char(13), '') from MyTable

Many thanks
Gee

Gee

"Happiness is a good health and a bad memory!"
Go to Top of Page
   

- Advertisement -