Deleting data from tables, keeping structure

  • Hi,

    I need to be able to delete all the data from 10 different tables and then import a cvs file to update data. Using "truncate" i get error

    Cannot truncate table 'tblname' because it is being referenced by a FOREIGN KEY constraint

    how do i go around this? Thanks!

  • You could simply go

    Delete from Mytable

    It doesn't have the same limitations as TRUNCATE TABLE, although you will have to empty the tables in the "right order" (delete the rows from Children table first, then the Parent tables).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply