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
A Simple Introduction to Cisco CML2
0 3698 0Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2
How to Build in a PSMethod to your PowerShell Code
0 68 0In this video, PowerShell instructor Jason Yoder shows how to add Methods (PSMethod) to your code using free software that’s added into the PSObject. For instructor-led PowerShell courses, see our course schedule. Microsoft Windows PowerShell Training Download the Building Methods PowerShell script</a> used in this video. <# ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ Building Methods ║ ╟──────────────────────────────────────────────────────────────────────────────╢ … Continue reading How to Build in a PSMethod to your PowerShell Code
Configuring Windows Mobility Center and How to Turn it On and Off
1 1411 1Video transcription Steve Fullmer: In our Windows training courses, we often share information about the Windows 8.1 Mobility Center. Mobility Center was introduced for mobile and laptop devices in Windows 7. It’s present and somewhat enhanced in Windows 8. Since we don’t have mobile devices in our classrooms, I decided to take a little bit … Continue reading Configuring Windows Mobility Center and How to Turn it On and Off
See what people are saying...