vertica add tag
user3503711 (imported from SE)
Currently I am using Vertica on Ubuntu 14.04 from the terminal as dbadmin. I am using 'admintools' to connect a database and then executing queries like Create Table, Select, Insert in the terminal.

Is there any way I can write the commands in any external text file and execute all the query at once? Like for Oracle, We can create a SQL file in Notepad++ and then run all the queries in the database. 
Top Answer
Monica (imported from SE)
Not only can you use scripts, but it's a good practice for any operation that you might need to repeat.

From the vsql prompt, use [the \i command](https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/ConnectingToVertica/vsql/Meta-Commands/iFILE.htm) to run a script:

    vsql> \i create_tables.sql

From outside the vsql prompt, you can invoke vsql with [-f filename](https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/ConnectingToVertica/vsql/CommandLineOptions/fFilename--fileFilename.htm).

File paths, if not absolute, are relative to the current working directory.

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.