SQL from shell script

Поиск
Список
Период
Сортировка
От sarlav kumar
Тема SQL from shell script
Дата
Msg-id 20050114183623.27104.qmail@web51306.mail.yahoo.com
обсуждение исходный текст
Ответы Re: SQL from shell script  (Sean Davis <sdavis2@mail.nih.gov>)
Список pgsql-novice
Hi All,
 
I have the following statements in my shell script:
 
echo $PGPASSWORD | psql -U $USER -h $HOST -d $DBNAME -c "select * from affiliate_batch where tx_dt < ' "$DATE" ' order by id; " > $1$DATE.1.txt
 
echo $PGPASSWORD | psql -U $USER -h $HOST -d $DBNAME -c "select * from affiliate_event where dt< ' "$DATE " ' order by id; " > $1$DATE.2.txt
 
I will be adding more statements in this file. I would like to know if there is a way to avoid specifying the connection everytime. I would like to make the connection once and then execute the set of SQL statements and disconnect from the database.
 
It would be great if someone could help me.
 
Thanks!
Saranya

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: N/A
Следующее
От: Sean Davis
Дата:
Сообщение: Re: SQL from shell script