Re: deleting table content through command prompt - Mailing list pgsql-general

From Harvey, Allan AC
Subject Re: deleting table content through command prompt
Date
Msg-id 3C2CED55DF019847AB7BD7317837BDA909B3E029@ntlmsg02.onesteel.com
Whole thread Raw
In response to deleting table content through command prompt  (sconeek@gmail.com)
List pgsql-general
Try

psql.exe -h localhost -U your_user -d your_database -c "drop table your_tablename;"

Assumption: windows switches are the same as the *nix ones

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of
> sconeek@gmail.com
> Sent: Thursday, 20 April 2006 9:04 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] deleting table content through command prompt
> 
> 
> hi all,
> i am trying to create a database backup and restore windows 
> batch file,
> which when run will do a database table backup and a corresponding
> table restore.
> 
> now for table_usernames backup i run something like from the command
> prompt,
> pg_dump.exe -i -h localhost -p 5432 -U postgres -F t -v -f
> "C:\usernames.backup" -t table_usernames "loginDetails"
> now for db restore i run something like from the command prompt,
> pg_restore.exe -i -h localhost -p 5432 -U postgres -d 
> "loginDetails" -a
> -t table_usernames -v "C:\usernames.backup"
> 
> the problem is that after i do a backup i need to delete the table
> content and then do a restore. through pgadmin i would do DELETE FROM
> table_usernames. however i need to do this from the command prompt,
> like how i am doing above.
> 
> it seems very obvious and simple, but i am unable to think of how i
> would do deletion of a table from the command prompt
> 
> thanks for all feedback and help.
> 
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
> 


The material contained in this email may be confidential, privileged or copyrighted. If you are not the intended
recipient,use, disclosure or copying of this information is prohibited. If you have received this document in error,
pleaseadvise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses
containedin this email or any attachments.
 

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: locating a primary key
Next
From: Klint Gore
Date:
Subject: Re: primary keys