Hi Jakub,

Virtuoso does not have a SQL to CSV export function/methods, we just have an 
import capability ...

Although coincidentally, a VOS user (Quentin <quent...@clearbluewater.com.au>) 
who last week wanted the same thing wrote the following procedure they sent to 
me, suggesting it should be considered for addition to  the VOS code base :

create procedure
cbw.DBA.csvExport( IN in_query VARCHAR, IN filename VARCHAR )
{

        declare query varchar;
        query := split_and_decode(in_query,0,'%');
        
        file_delete(filename,1);

        declare meta, _dt any;
        declare errorCode, errorMessage varchar;
        declare inx integer;
        exec (query, errorCode, errorMessage, vector(), 0, meta, _dt);

        declare linestr varchar;
        declare flag integer;
        linestr := '';
        if (meta <> 0) {
                flag := 0;
                FOREACH (varchar col in meta[0]) DO {
                        if (flag = 0) flag := 1;
                        else linestr:=concat(linestr,',');
                        linestr := concat(linestr,'"',col[0],'"');
                }
                string_to_file(filename,linestr,-2);
                string_to_file(filename,'\n',-1);
                -- Header is now complete
                inx := 0;
                if (_dt <> 0) {
                  while (inx < length (_dt))
                    {
                                linestr := '';
                                flag := 0;
                                FOREACH (any col in _dt[inx]) DO {
                                        if (flag = 0) flag := 1;
                                        else linestr:=concat(linestr,',');
                                        linestr := concat(linestr,'"',col,'"');
                                }
                                string_to_file(filename,linestr,-1);
                                string_to_file(filename,'\n',-1);
                        inx := inx + 1;
                                
                    }
                }
        } else return 'No records or some error';

}

So you are welcome to try it and let us know if it works for you ...

Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.      //              http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers

On 28 Apr 2014, at 16:27, Jakub Káňa <jakubk...@gmail.com> wrote:

> How can I export database table to CSV file. I am using Open-Source version 
> of Virtuoso (7.1) Win x64
> 
> Thank you 
> Jakub
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs_______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to