John
I think you can do this way on shell:
mysql -h db_server -u user -pPASSWORD <DATABASE> -e "truncate table
table1"
Carlos Eduardo Caldi
> Date: Tue, 16 Mar 2010 14:12:42 -0700
> From: [email protected]
> To: [email protected]
> Subject: Trancate table from command line?
>
> Is there a way to use mysqladmin (or mysql) to truncate a table as a
> one-off command from the command line?
>
> I have an issue with importing data from one database into another, but
> the second database might have columns that the first did not.
>
> On database 1, I use mysqldump to grab certain tables, and when I try to
> simply "overlay" those tables onto the new database, I get an error
>
> ERROR 1062 (23000) at line 24: Duplicate entry '378-4' for key 1
>
> So we're thinking we should truncate the table first, but it appears
> this must be done manually in the mysql> shell, which won't work... this
> operation needs to be scripted, or to be presented as one command line
> that can be copy-and-pasted.
>
> How can I do something like :
>
> mysqladmin -h db_server -u user -pPASSWORD <DATABASE> truncate table
> table1 ?
>
> --
> ***********************************************************************
> * John Oliver http://www.john-oliver.net/ *
> * *
> ***********************************************************************
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/[email protected]
>
_________________________________________________________________
Não deixe rastros ao navegar na Internet. Instale Grátis o Internet Explorer 8
agora.
http://go.microsoft.com/?linkid=9707132