By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,873 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Batch file + psql problem

P: 6
Hi,

I'd like to return the output, or output as a variable, from a pgSQL query that I'm executing through batch file back to the batch file so that it executes a line in particular of the batch file (through a 'goto' command I think).

I manage to execute the query and see the result (in cmd) but am not sure how I can grab that result and use it.

If anybody's got any ideas...?

Thanks,

Matt
Dec 12 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 700
Hi,

I'd like to return the output, or output as a variable, from a pgSQL query that I'm executing through batch file back to the batch file so that it executes a line in particular of the batch file (through a 'goto' command I think).

I manage to execute the query and see the result (in cmd) but am not sure how I can grab that result and use it.

If anybody's got any ideas...?

Thanks,

Matt
I'm afraid I don't get your problem (probably because of my poor english) but are you looking for something like that

for zm in `psql -t -A -c "select column_name from table_name"`
do
#do something with $zm
done;
Dec 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.