Thread: Using sql statements in file
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Hi,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">I would like to do the following using files:</span></font><p class="MsoNormal"><font face="Arial" size="2"><spanstyle="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">1. <span class="GramE">put</span> create database, create tables sql statements in a file and executethrough prompt</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">2. <span class="GramE">insert</span> or update data that is put in a file</span></font><p class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Please let me know if there are any examples that lists how sql statements can <span class="GramE">be<span style="mso-spacerun:yes"> </span>put</span> in a file and used.</span></font><p class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Thanks</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Suresh Basandra</span></font></div>
> 1. put create database, create tables sql statements in a file and > execute through prompt > 2. insert or update data that is put in a file Place your commands in a file & execute them either from the prompt or from psql. Remember to create your file in the below order: 1) create database 2) connect to new database (\c) 3) create tables/views/functions ... 4) insert/update commands regards, bhuvaneswaran
On Mon, 22 Sep 2003, Suresh Basandra wrote: > Hi, > > I would like to do the following using files: > > 1. put create database, create tables sql statements in a file and > execute through prompt > 2. insert or update data that is put in a file > > Please let me know if there are any examples that lists how sql > statements can be put in a file and used. psql dbnamehere <filename.sql