Ask Ben: Exporting A Query To CSV Without Using Column Names

<cffunction
	name="PrepareCSVValue"
	access="public"
	returntype="string"
	output="false"
	hint="I take a CSV value and prepare it for the file.">
 
	<!--- Define arguments. --->
	<cfargument
		name="Value"
		type="string"
		required="true"
		hint="I am the raw data value."
		/>
 
	<!---
		Esacpe any quotes in the value and then return the clean
		escaped string surrounded by quotes.
	--->
	<cfreturn
		(
			"""" &
			Replace(
				ARGUMENTS.Value,
				"""",
				"""""",
				"all"
				) &
			""""
		)
		/>
</cffunction>

For Cut-and-Paste