How to use Environment Vairalbes when Running Query Script

Hello,

I have a couple of scripts where I'm using \set NAME VALUE to set parameters in my queries' scripts.

 

Is there a way to read the parameters from environment variables passed to vsql utility?

Hello,

I have a couple of scripts where I'm using \set NAME VALUE to set parameters in my queries' scripts.

 

Is there a way to read the parameters from environment variables passed to vsql utility?

 

START_DATE=2016-01-01 END_DATE=2016-01-31 vsql -dDB_NAME -c "SELECT * FROM myTable WHERE ts_date BETWEEN '$START_DATE' AND '$END_DATE' ;"

 

Thank you,

Yarden

START_DATE=2016-01-01 END_DATE=2016-01-31 vsql -dDB_NAME -c "SELECT * FROM myTable WHERE ts_date BETWEEN '$START_DATE' AND "$END_DATE" ;"

Thank you,

Yarden

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file