MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 3rd, 2004, 11:08 AM
rishijd rishijd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 288 rishijd User rank is Lance Corporal (50 - 100 Reputation Level)rishijd User rank is Lance Corporal (50 - 100 Reputation Level)rishijd User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 6 h 48 m 9 sec
Reputation Power: 5
export data to csv: escape new lines?

Hi,
I need to convert from mssqlto Postgres and I need to export all MS-SQL table data to a CSV or TXT file (one file per table)

Presumably, all data per row (of a table) must be in one line.
Then when you copy to another database, a new line of data means a new row in the table.

However, MS SQL is exporting a large varchar text field as multiple lines. The data itself is many lines, so exporting it causes the data for one row to fall onto many lines.

My question: How do I escape new lines? When MS SQL exports the data, I want to replace all NEW LINES / carriage returns by /n or by <br> tag (since the data will be for web use).

(pls note I am not actually handling the ms sql database, so any response would be greatly appreciated as I advise the person in charge of the mssql db accordingly).

Thanks a lot!

Reply With Quote
  #2  
Old August 13th, 2004, 04:17 AM
cell-gfx cell-gfx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 cell-gfx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can specify a text file as a target in DTS when performing a Transform Data Task or a Data Driven Query Task.

When the target text file is specified, clicking on the Properties button allows you to specify how the row is delimited. As you'll see from the attached screenshot, you can specify what that delimiter is. You can also amend how the data is delimited as well.

Hope this helps.
Attached Images
File Type: jpg csv.jpg (31.4 KB, 244 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > export data to csv: escape new lines?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway