How to delete a datas in whole database?

  • Hi,

    I am Rajasekar,

    How to delete a records in whole database(in this database having more than 200 tables)

  • Use the information_schema.tables view to help you write a script that does what you need. I do this regularly with selects similar to select 'first part of text ' + table_name + ' rest of text' from information_schema.tables where criteria for table names.

    Run the script to text and then copy the output to a query window and execute. We have computers, let htem do the hard, repetitive work.

  • Since you want to do the "whole" db. Would it not be faster to just script all the tables and associated constraints & settings (or probably the whole DB), drop the old tables create new ones?

    I guess the potential pitfall is any internals (like hypotheticals) for performance are potentially lost but it could also be an improvement?

  • This database doesn't have any "lookup" tables? It's all user data?

    Either above suggestion would work, as long as you don't have "lookup" table data, then you'll need to customize either of the two suggestions.

Viewing 4 posts - 1 through 3 (of 3 total)

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