How to select multiple SQL Server database objects in SSMS

Home > Blogs > SQL Server > How to select multiple SQL Server database objects in SSMS

How to select multiple SQL Server database objects in SSMS

Like This Blog 6 Peter Avila
Added by February 8, 2013

My students sometimes ask me how they can script multiple tables, views, or other database objects at once without having to do it one at a time. They correctly point out that you can select only one table at a time in SQL Server Management Studio’s Object Explorer, only one view at a time, one stored procedure at a time, and so on.

There is a way to select multiple tables, views, and other database objects and script them all at once. The Object Explorer Details panel lets you do that. Here’s how:

  1. Use the View menu to display both the Object Explorer and the Object Explorer Details panels. While you have the View menu open, notice the shortcuts, F7 and F8. Microsoft wanted to make it real easy to open these two windows (aka view or panel) because they form a very useful combination.

  1. Once you have both open, notice how they work together. When you select something in the Object Explorer panel, the Object Explorer Details panel responds by showing the contents, or details, of the item you selected.

Select the Tables folder in the AdventureWorks database and notice that the contents of the folder are displayed in the Object Explorer Details panel.

  1. We’re ready to select multiple tables. In the Object Explorer Details panel, hold down the Ctrl key as you click on the Employee, EmployeeAddress, AddressType, and Address tables.

  1. Now you just right-click on the selected items to either script them or delete them. Select Script Table as, Create to, New Query Editor Window.

  1. Notice the new query window that opens. Scroll through it to see the scripts that create the four tables we selected.

Use this same approach to script views, stored procedures, functions, and other database objects.

Peter Avila
SQL Server Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 153 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Windows 10 Features and Navigation – December 1, 2015

0 114 1

In this recorded Windows 10 webinar from December 1,2015, Windows Instructor Steve Fullmer presents the navigation and some of the new features associated with Windows 10 including Sysinternals Tools for Windows Client, Windows core concepts, exploring Process Explorer as well as some of the features that are not yet ready for prime time but will … Continue reading Windows 10 Features and Navigation – December 1, 2015

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 608 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

See what people are saying...

  1. Avatar dewitte

    I never knew this – thank you very much for posting! I was so used to SQL 2000 Enterprise Manager just showing everything, I had no idea there was another panel.

  2. Avatar RichardAD

    This blog post was #1 hit whilst searching for “ssms delete multiple tables”. Thanks!

  3. Avatar Hans

    Excellent tip, thank you!

  4. Avatar naqi zaidi

    they can multiple tables join many to many relation table . i have tier to delete a table from foreign key table .

  5. Avatar Uwe from

    That was awesome! Also I knew this Object Explorer Details window, I never dared they actually put something useful into it.

    So thanks a lot for explaining it.

  6. Avatar Alexei

    Thanks!! This will ease my task of coping 150 procedures from one server to another! 🙂

Share your thoughts...

Please fill out the comment form below to post a reply.