Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164

    Unanswered: Deleting all records in a table

    I am trying to write a transact sql statment to delete all records in a table. What is wrong with the following statment?

    DELETE * FROM tblPerson
    GO


    Thanks

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    Should be just

    DELETE FROM tblperson

    unless you are using a WHERE CLAUSE such as

    DELETE FROM tblperson WHERE id = 1

  3. #3
    Join Date
    Dec 2002
    Posts
    1,245

    Re: Deleting all records in a table

    Depending on the size of the table, you may also wish to consider truncating it. In general, a TRUNCATE statement will perform much faster than a DELETE. Try:

    TRUNCATE TABLE tblPerson

    Originally posted by Sia
    I am trying to write a transact sql statment to delete all records in a table. What is wrong with the following statment?

    DELETE * FROM tblPerson
    GO


    Thanks

  4. #4
    Join Date
    Feb 2003
    Location
    canada
    Posts
    1

    Unhappy Re: Deleting all records in a table

    Originally posted by hmscott
    Depending on the size of the table, you may also wish to consider truncating it. In general, a TRUNCATE statement will perform much faster than a DELETE. Try:

    TRUNCATE TABLE tblPerson

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •