July 10, 2018 at 1:46 pm
Hi,
I ran a script to install a database and did not notice that it is going to put them all on the master database. Now I have a messy master database with some 20 tables there. I cannot delete them as they have dependencies. I can probably go drop constraint one by one and try again, but I was just wondering if there is a better and smarter method to do just that.
thank
July 10, 2018 at 2:25 pm
mohandesan 32791 - Tuesday, July 10, 2018 1:46 PMHi,I ran a script to install a database and did not notice that it is going to put them all on the master database. Now I have a messy master database with some 20 tables there. I cannot delete them as they have dependencies. I can probably go drop constraint one by one and try again, but I was just wondering if there is a better and smarter method to do just that.
thank
One fairly easy way -
Check your script options (tools - options - SQL Server object explorer - scripting) and make sure to enable Generate Script for Dependent objects
Then open object explorer details for master database
Select the tables you want to delete and then right click and select Script table as drop to...(file, query window) and it will generate the script to drop the dependent objects and the table.
It's faster to do that than it is to type how to do it.
Sue
July 10, 2018 at 5:21 pm
Wonderful solution Sue. Thank you.
July 11, 2018 at 11:27 am
Datazita - Tuesday, July 10, 2018 5:21 PMWonderful solution Sue. Thank you.
Your very welcome...thanks for the feedback. Object explorer details view is good for selecting different things like that - with Ctrl select or shift select.
Sue
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply