Обсуждение: Using sql statements in file

Поиск
Список
Период
Сортировка

Using sql statements in file

От
"Suresh Basandra"
Дата:

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.

 

Thanks

Suresh Basandra

Re: Using sql statements in file

От
"A.Bhuvaneswaran"
Дата:
> 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




Re: Using sql statements in file

От
"scott.marlowe"
Дата:
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