Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export to text file with char(13)

Status
Not open for further replies.

chaoma

Technical User
Apr 17, 2005
101
US
Hello,

I need to export this table to a text file. Here is how the table was created:

Select row_id+
column1+
column2+
char(13)+
row_id+
column3
from my table

With Char(13), it should split the data into 2 rows per record. However, after I export the table using DTS, it showed only one long row per record. What am I doing wrong? Was using Char(13) incorrect?

Note that row_id showed twice.

Thanks.
 
What column does the char 13 refer to? In that code, you are getting one long string for each row because you have + as opposed to ,

What you could do is something like the below, but only as a rough guide (using substrings)

Code:
select rownum, col2, substring (text, 1, 13)
from ml
union
select rownum, col2, substring (text, 14, 255)
from ml
order by rownum

replace the table name, field names etc. ant where I have the field "text" in brackets, change that to the one you are trying to split.
 
Mutley,

Thank you again. You have save my day. I was going to write a more complex code. First, I thought your code doesn't work, but after a while it starts to make sense.

Thanks.
 
Without seeing any sample data I just took a guess. Not sure of your fields / data types etc. so was just a quick knock-up. Glad to help / at least give you a pointer.

Good Luck!!!

Cheers,

M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top