Friday, April 5, 2019

How to create CSV output from NetSuite ODBC using SQL

CSV output can be generated using SQL via NetSuite ODBC interface.
To do this the output needs to be in one field only. Therefore fields need to be concatenated. For longer fields use combination of "concat" function and "+" operator.

Example:

select concat('','"' + category_0 + '","' + companyname + '","' + full_name + '", "' + email + '"') as data from customers;

Output:

"CUSTOMER","Netsuite","Homer Simpson", """CUSTOMER","Limited L.t.d","Rene Mrkvon", "rene.mrkvon@holywood.com""CUSTOMER","Bankert Bank","Bankert Bank", "jr@benkert.com""PROSPECT","Speedy Delivery Service","Speedy Delivery Service", "thansen@speedydel.com""CUSTOMER","Cara Systems","Cara Systems", "jstorm@cara.com"

No comments:

Post a Comment