|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
command line script
hi to all
how to execute one script in command line? in post gress sql for example i write some query in myfile.sql. myfile.sql contents select * from emp; ok now i want to execute this file (myfile.sql) script from command line. pl tell me how to execute this? thank u |
|
#2
|
||||
|
||||
|
You can use psql to do this.
psql -f myfile.sql will read the file myfile.sql and output its results to screen. If you want to save them in a file, you can do psql -f myfile.sql >results.txt You may need to specify the database you're querying, and your user name. psql -f mysql.sql -d databasename -U username If you want to format the output of your result, take a look at this thread Other options are available. You can see them using psql --help Hope this helps. |
|
#3
|
|||
|
|||
|
hi
thank u very much bye jagan |
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > command line script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|