Home Dashboard Directory Help
Search

Invoke-SQLCmd cmdlet for Windows Powershell by SQL_Guru


Status: 

Closed
 as Fixed Help for as Fixed


3
0
Sign in
to vote
Type: Suggestion
ID: 291527
Opened: 8/7/2007 10:05:27 AM
Access Restriction: Public
0
Workaround(s)
view

Description

I've developed my own Invoke-SQL.ps1 powershell script for querying SQL Server, but it doesn't have lots of features. Please develop an Invoke-SQLCmd cmdlet for Windows Powershell that loosely matches the syntax of SQLCMD.exe. This would allow me to easily do queries against multiple servers and combine the information from the servers.

I'll include the script I've put together so far as an example.
Details
Sign in to post a comment.
Posted by Stephen Mills on 3/27/2012 at 3:53 PM
Although this was added, Invoke-SQLCmd has relatively little in the way of functionality. The biggest defect is that you can't tell which result set a set of rows came from. i.e. "select name as [Name] from sys.databases;Select @@servername as [Name]; select name as [Name] from sys.server_principals". Good luck figuring out the name of the server. If it had some way of determining the result set it came from, you could look at the second result set to get the name of the server.
Posted by Microsoft on 10/10/2007 at 11:26 AM
SQL Guru,

I'm resolving this suggestion as fixed as this functionality should be in CTP6 of SQL Server 2008.

-Richard Waymire
Program Manager, SQL Server
Posted by Microsoft on 8/16/2007 at 12:24 PM
SQL Guru,

We are very interested in powershell for the next release of SQL Server, and appreciate your suggestion that we provide this functionality.

-Richard Waymire
Program Manager, SQL Server
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
Invoke-SQL.ps1 (restricted) 8/7/2007 -