How to select multiple SQL Server database objects in SSMS
How to select multiple SQL Server database objects in SSMS
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:
- 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.
- 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.
- 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.
- 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.
- 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
You May Also Like
Agile Methodology in Project Management
0 184 0In 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
An Overview of Office 365 – Administration Portal and Admin Center
0 950 3This is part 1 of our 5-part Office 365 free training course. In this Office 365 training video, instructor Spike Xavier introduces some of the most popular services found in Microsoft Office 365 including the Admin Portal and Admin Center. For instructor-led Office 365 training classes, see our course schedule: Spike Xavier SharePoint Instructor – … Continue reading An Overview of Office 365 – Administration Portal and Admin Center
Creating Users and Managing Passwords in Microsoft Office 365
0 795 4In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365. For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365
See what people are saying...