Skip to content

How to run SQL script from text file

Mathias Rangel Wulff edited this page Mar 14, 2017 · 6 revisions

How to run SQL script from text file?

Question

I have all my SQL statements in a text file. How to run it in AlaSQL?

Answer

You can use SOURCE statement:

    alasql('SOURCE "myfile.sql"');

Please not that accessing files in a browser should be done async:

    alasql(['SOURCE "myfile.sql"']).then(function(){ 
    	... 
    });
Clone this wiki locally