Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete every row 1

Status
Not open for further replies.

macubergeek

IS-IT--Management
Joined
Dec 29, 2004
Messages
41
Location
US
I'm trying to figure out the sql syntax to delete every row from a specified table. I don't want to drop the table just clean out every row...

I've tried:
DELETE * FROM TABLE_NAME;

DELETE * FROM TABLE_NAME WHERE id NOT NULL;

no luck.
Can someone give me a shove in the right direction?
 
delete from table_name
 
Another option would be "TRUNCATE tablename". The effect is the same as DELETE, but for big tables it's much faster.
 
lgarner and TonyGroves, thanks! Some how I was stuck in the SELECT syntax format. DELETE from <tablename> worked fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top