dim result as C = ToCSVFile(TargetFile as C, SQLStatement as C [, Arguments as SQL::Arguments] [, IncludeHeaderRow as L = .f. [, RowsToCopy as N = -1[, StartRow as N = -1 [, UpperCaseNames as L = .f. [, DateTimeFormat as C = "" [, DateFormat as C = "" [, TextToSubstituteForBinary as C = "<Binary Data>"]]]]]]]])
The name of the file to store the data, including the file path.
A SQL SELECT statement.
Default = null_value(). A SQL::Arguments object. One or more arguments to be resolved when the SELECT statement is executed.
Default = .f.. If true, the first row in the result will be the column names.
Default = -1 (copy all rows). The number of rows to copy.
Default = -1 (start with next row in the result set). The starting row.
Default = .f.. If true and the header row is included, the header row column names will be converted to uppercase.
Default = "". The date time format used to format date time fields in the CSV file. See Date and Time Format Elements for more information about date time formats.
Default = "". The date format used to format date fields in the CSV file. See Date and Time Format Elements for more information about date formats.
Default = "<Binary Data>". A text string used in place of binary data in the CSV file.
Returns .T. if the data was successfully saved to a CSV file. If result is .F., the file was not created. Check the result of SQL::ResultSet's callResult object for more info about the error.
Fetch data using a SQL query and save the data to file as a CSV formatted string.
dim cn as SQL::Connection cn.open("::Name::AADemo-Northwind") dim filename as c = "C:\Users\someuser\Documents\orders.csv" dim sql as c = "select FIRST 5 * from orders" ? cn.toCSVFile(filename,sql) = .T.