How to get empty tables and delete from database

  • How to get those tables in which there is no any data and each tables have some constraints.

    and we want to delete those tables from the database.

  • just because a table has no rows does not mean that table has not been referenced by a view/stored proc / function or external application; it is perfectly normal to have tables that are empty until they are actually used.

    how do you KNOW the table is not being used? you have to sift through source code to be sure. This would be doubly true if a constraint exists on the table...if someone went to the trouble to add constraints or foreign keys, clearly there is some logic tied to the table, so it's very doubtful it should be removed jsut because it has no rows.

    there is a similar thread where someone wanted to know how to determine if a table has not been used recently so it can be removed.

    check out the many smart comments on that thread, as it pertains to your situation as well.

    http://www.sqlservercentral.com/Forums/Topic940111-391-1.aspx

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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