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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSV export problems

Status
Not open for further replies.

mossbs

Programmer
Joined
Aug 19, 2008
Messages
102
Location
GB
hi guys,

got a stored procedure that returns data dependant on a variable, (i pass in a code dependant on what i want to see etc)... have set up a SSIS package to automate this - to run the procedure, return the results and stick them in a csv file attachemnt to an email that is sent etc.

However... as the data returned is dealing with addresses, some of the feilds have commas within them and so are being treated as a new column when converting to csv.

is there anyway to handle this?

cheers,

Dan
 
YOU could use replace function and strip out , and replace with space

Replace(yourstringfield, ',', ' ')

Ian
 
if you need to preserve the comma's, then you can force your procedure to pre and append " to text type data columns, i.e.
select '"' + column + '"' from table

you need to watch out for " within your text as well, you can get around this usually with escape characters, I believe for excel, the escape character is " (but don't quote me on this, I don't use excel a lot...) so you'd do something like:
replace(column, '"', '""')


--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top