Re: deleting table content through command prompt

From: "Harvey, Allan AC" <HarveyA(at)OneSteel(dot)com>
To: <sconeek(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: deleting table content through command prompt
Date: 2006-04-20 03:56:04
Message-ID: 3C2CED55DF019847AB7BD7317837BDA909B3E029@ntlmsg02.onesteel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of
> sconeek(at)gmail(dot)com
> Sent: Thursday, 20 April 2006 9:04 AM
> To: pgsql-general(at)postgresql(dot)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, please advise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses contained in this email or any attachments.

Browse pgsql-general by date

  From Date Subject
Next Message Patrick TJ McPhee 2006-04-20 04:19:51 Re: primary keys
Previous Message Joshua D. Drake 2006-04-20 03:45:28 Re: locating a primary key