Hi Mike,
to have that result you have put values in the vachar defined fields without trimming blanks, why?
Anyway you can resolve in this way:
set fields GLOBAL set fields to
set fields to PseudoID = rtrim(PseudoID), Zip3, Prov03, Prov03Other = rtrim(Prov03Other), Prov06, Prov07, Prov07Other = rtrim(Prov07Other), Prov08
copy to MyCSVFile type CSV
set fields to set fields LOCAL
Be careful with the order of the various "set fields ..." commands!
Gianni
On Mon, 27 Nov 2017 11:43:00 -0500, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Just an interesting find I wanted to share. When I create my cursor with traditional c(N) widths, the CSV export does NOT have any extra spaces added to the output.
pseudoid,zip3,prov03,prov03other,prov06,prov07,prov07other,prov08 "Pseudo1","333","C001","","10","C021","","C025" "Pseudo2","333","C001","","20","C021","","C026" "Pseudo3","333","C001","","30","C021","","C019"
But when I use varchar v(N) field declarations, it appends spaces to the end of the field values:
pseudoid,zip3,prov03,prov03other,prov06,prov07,prov07other,prov08 "Pseudo1 ","333","C001"," ","10 ","C021"," ","C025" "Pseudo2 ","333","C001"," ","20 ","C021"," ","C026" "Pseudo3 ","333","C001"," ","30 ","C021"," ","C019"
Here's the declaration:
CREATE CURSOR curProvData (iid i, PseudoID c(20), Zip3 c(3), Prov03 c(4), Prov03Other c(254), Prov06 c(8), Prov07 c(4), Prov07Other c(254), Prov08 c(4))