简体   繁体   中英

Using apache camel, sql to create csv files

I am trying to use Apache camel to run SQL, save the results to CSV file with headers. I don't know of a way to specify headers for columns within camel. Is there a way to do it? My database is SQL Server

I don't know enough about apache camel, but because you should be careful saving non-string data as strings anyway, you could convert all your data to the appropriate varchar/nvarchar (only in your query, no table changes) and use UNION ALL to preprend your headers. It's easy, and forces you into making a decision about what format you what dates (and other types) to be in.

Of course, it's "too much work", considering there is bound to be some simple flag to do it for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM