Creating batch file for SQL
Hi All,
We have a requirement to create a batch file for a SQL file (with series of delete and insert commands) so that we can create scheduler event in Windows to execute the commands automatically every weekend.
Kindly let me know if it's possible. If so, kindly share the sample script for the same.
Regards
Amit
0
Comments
Hi,
You can run batch files using Vertica's CLI tool vsql. On Windows vsql is installed via the Windows client drivers which can be downloaded from here:
https://my.vertica.com/download/vertica/client-drivers/
Here is a link to the docs showing how to run vsql on the command line:
https://my.vertica.com/docs/9.1.x/HTML/index.htm#Authoring/ConnectingToVertica/vsql/ConnectingFromTheCommandLine.htm
Basically, just create a text file that contains your DELETE and INSERT statements then use the -f command line option to tel vsql to use your file as a source of commands instead of reading commands interactively. After the file is processed, vsql terminates.