View Full Version : delete rows from table
reigalz
10-29-2002, 11:56 AM
hi, how do i delete all the rows from a table? means there will be no data in the table. thanks!
rcreyes
10-29-2002, 01:09 PM
Here's the syntax:
Delete tablename
for example to delete all rows from employee table:
delete employee
Thanks,
Ray
Spookster
10-29-2002, 02:06 PM
Well actuall it should be
DELETE FROM tablename
without a where clause to delete all the rows. However a faster method is to truncate the table
TRUNCATE TABLE table_name
Instead of deleting the rows one at a time it drops the tables and then recreates it.
rcreyes
10-29-2002, 02:26 PM
Thanks for correcting I was using a MS-SQL syntax, and did not realized it......
However, just a note that when using the
DELETE FROM tablename
this will return zero as the number of affected records
To determine how many records were actually deleted, you can use the following
DELETE FROM TableName where 1>0
Thanks ...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.