Join Martin Guidry for an in-depth discussion in this video Using Windows PowerShell to run SQL commands, part of Designing Database Solutions for SQL Server 2012.
- View Offline
- Exercise Files
- In this section, I'd like to talk about using powershell…to run queries against our SQL Server 2012 databases.…I'm gonna go to the start menu,…type in powershell…and open up the Windows powershell command.…Sometimes, I like to adjust…the size of the powershell window.…If you right-click in the title bar…and go to Properties, you'll have…the option to change the font.…First thing I'll need to do is…load the SQL powershell commands.…
So, that is import-module…and in the quotes, sqlps…and I'll probably get a warning…about the Analysis Services again.…Not a problem.…Not going to affect what I'm trying to accomplish here.…Now, in order to issue a traditional SQL command,…I'll need to first enter the powershell command,…Invoke-SQLcmd.…Then, we'll need to say -Query…to specify that we are running a query…and in quotes, we'll go ahead and…type out our query.…
I'd like to do a SELECT *…from a table in the Adventure Works database.…When I type in the name of the table,…I'm going to need to specify that it is…in the adventure works 2012 database.…
- Planning the database infrastructure
- Designing databases vs. data warehouses
- Designing the physical database implementation
- Planning for partitioning
- Adding FileStream data
- Monitoring server health
- Managing SQL Server with PowerShell
Skill Level Intermediate
1. Designing a Database Server Infrastructure
2. Designing a Logical Database Schema
3. Designing a Physical Database Implementation
4. Incorporating Data Files into Databases
5. Tuning Database Performance
6. Policy-Based Management
7. Monitoring Server Health
Exploring health data5m 3s
8. Managing SQL Server with PowerShell
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.