Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
9619 มุมมอง

Is it possible to truncate the sale.order table from ubuntu terminal.

If yes please mention how it .

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

On the terminal

step 1. Locate postgresql, e.g. cd /opt/PostgreSQL/9.1/bin
step 2.  ./psql  --u database name.
step 3. /l  (database list)
step 4. /d (table list)

To truncate table:-

 truncate table table_name cascade (cascade if table contain relationship)
อวตาร
ละทิ้ง
ผู้เขียน

Thank Gopakumar. Is there any way to remove all the datas(sales, hr, products) in the database in a single step. But not affecting the default values. eg. In product's table product service

ผู้เขียน

Error occured like this... root@jyothish-System-Product-Name:/usr/lib/postgresql/9.1/bin# ./psql --u ILAJ admin psql: FATAL: Peer authentication failed for user "ILAJ"

@47114 check the username and password you have entered, make sure that you are using correct username and password.

ผู้เขียน

i use the command TRUNCATE TABLE sale_order RESTART IDENTITY CASCADE; The table will be truncated but the id will not be reset . How can be make the id to start from the begining..