Generate a CSV file for a MS SQL Server table. The solution contains a single function that given a connection string, table name, and file path, will create a CSV file containing the contents of the table.
It uses Linx's capabilities to run dynamic queries and write to text files.
Select the GenerateCSVFromTable function, click Debug, supply values for ConnectionString, TableName, and FilePath parameters, and click Start.
Copy GenerateCSVFromTable to your solution and call it from anywhere.
To use it with other databases, change the connection type and SQL properties in the GetCSVHeader and GetCSVData functions.
If the source data contains the delimiter and/or line feeds, the CSV file will be invalid. The function can be extended to cater for these scenarios.
For questions please ask the Linx community.