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.
Author |
Topic |
-Dman100-
Posting Yak Master
210 Posts |
Posted - 2007-06-07 : 13:04:49
|
I'm exporting using a query to a flat .txt file. The problem I'm encountering is when I export the data and then open the .txt file into excel some columns cause line breaks to the next row. The columns that are breaking to a new row are varchar fields where the user has entered text into the field with double quotes ".When I export, I'm using row delimiter {CR}{LF} column delimiter Comma and text qualifier Double Quote (")Is there a way to prevent this from happening when I export and open the flat file into Excel?Thanks for any help. |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-07 : 13:09:35
|
try doing a REPLACE(REPLACE(YourColumn,CHAR(10),''),CHAR(13),'') to see if makes any differenceDinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2007-06-07 : 13:10:47
|
Can you use another text qualifier, or another delimiter, i.e. pipes (|)?Mark |
|
|
-Dman100-
Posting Yak Master
210 Posts |
Posted - 2007-06-07 : 14:13:15
|
I tried the replace, but I was getting a syntax error in my query. Here is the query without using replace:SELECT e.session_date, l.lab_no, i.first_name + ' ' + i.last_name AS Teacher, tt.name, d.district_name, s.school_name, t.title, a.q1 AS Question1, a.q2 AS Question2, a.q3 AS Question3, a.q4 AS Question4, a.q5 AS Question5, a.q6 AS Question6, a.q7 AS Question7, a.q8 AS Question8, a.q9 AS Question9, a.q10 AS Question10FROM evaluation eLEFT OUTER JOIN training t ON t.id = e.trainingLEFT OUTER JOIN lab l ON l.id = e.lab_noLEFT OUTER JOIN instructor i ON i.id = e.instructorLEFT OUTER JOIN trainee tt ON tt.id = e.traineeLEFT OUTER JOIN district d ON d.id = e.districtLEFT OUTER JOIN school s ON s.id = e.schoolLEFT OUTER JOIN answers a ON a.id = e.answersWHERE session_date >= '20070401' AND session_date < '20070501'I would need to use the replace on columns a.q7, a.q8, a.q9, and a.q10I tried using another delimite...pipes (|) and that didn't work? Maybe I was attempting it incorrectly? |
|
|
|
|
|
|
|