Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to Run a SQL Script / File


There are several ways to run queries from a SQL file. One of the easiest ways is run scripts directly using the CSQL command line interpreter. Assuming the script you want to run is named "insert_commands.sql", the following commands should be ran within csql:

;CL
;READ insert_commands.sql
;RU 

The first command, clears the command line buffer (;CLear). The second reads the sql script into the command line buffer (;REAd). The last command executes the commands in the command line buffer (;RUn).

Note: If you want the script to run quicker, then you should set autocommit to off. To do this, before running the ;RU command, you should run:

;AU off

This command disables autocommit. Due to this reason, after you run the sql script, in order to commit your changes made, you MUST run:

;commit

;commit (or ;co) commits all changes made.

If you still encounter problems and you are not able to run a SQL script or import a SQL file, please contact us by posting a message in our Q&A site.

comments powered by Disqus
Page info
viewed 3552 times
translations en
Author
posted 2 years ago by
CUBRID
Contributors
updated last year by
View revisions
Share this article