1) Run someting like the following to generate your data set. Note the end result will be a text file that is bar, |, delimited.
SELECT CONCAT(
number,
'|',
CONVERT(VARCHAR, [begin]),
'|',
REPLACE ( descript , CHAR(13) + CHAR(10) , ' ' ), -- AS descript,
'|',
REPLACE ( Notes , CHAR(13) + CHAR(10) , ' ' ), -- AS Notes,
'|',
REPLACE ( s_notes , CHAR(13) + CHAR(10) , ' ' )) -- AS s_notes
FROM stage.LeaseDuplicates;
2) Save the data set as a text file.
3) Import into Excel selecting the bar, |, as the delimiter.
This blog is a collection of hints, issues, and notes that I have encountered on my journey as a software developer. As I've now transitioned into that "Dinosaur" phase as a software developer (40+) I find I need to write things down or refer to things way more often than I used to. This site is my ad-hoc collection of database (Oracle/SQL Server) and application development (.NET, PL/SQL, TSQL) topics. Hopefully it will help someone find a solution to something their working on.
Sunday, April 24, 2016
Loading data into SQL Server that has Carriage Returns, Line Feeds, and Commas
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment