SAVE
Statement
Saves the notebook to disk.
Syntax
SAVE;
SAVE filename;
Parameters
- filename: text (optional)
The path where the notebook should be saved. If not provided, the notebook is saved to its existing filename. If the notebook is untitled and no filename is provided, an error is thrown.
Examples
SAVE 'C:\Data\my-notebook.sqlnb';
Saves the notebook to the specified path.SAVE;
Saves the notebook to its existing filename. If the notebook is untitled, this will throw an error.
Remarks
The SAVE
statement is particularly useful in scripts to ensure changes are persisted to disk.
Important: The SAVE
statement only works outside of a transaction. If you have an
active transaction, SAVE
will fail with an error. Because the SQL Notebook UI defaults script execution
to "Implicit BEGIN ... COMMIT" transaction mode, the SAVE
command will produce an error when first
attempted in the UI. To use SAVE
in the UI, you must change the transaction mode to "None (auto-commit)"
before executing your script.
This transaction limitation does not affect the SqlNotebookCmd
command line tool, which does not use
implicit transactions.