Thursday, June 21, 2007

SQL Server Provider/Namespace for PowerShell (Think "Easy Command Line/PowerShell Access to SQL Server Data")

Windows PowerShell - Demo SQL Provider Code

"Hi,

Attached is the code we used today in the Web cast for the SQL demo provider. Please note this is not a SQL management provider. It simply allows you to query data from a SQL server directly from the cmd line.

...

You can use it as follows:

PS>cd SQL:
SQL:>cd MySQLServer
SQL:>dir

master
tempdb
model
msdb
pubs
Northwind

SQL:>cd Northwind
SQL:>dir

name
----
Categories
CustomerCustomerDemo
CustomerDemographics
Customers
dtproperties
Employees
...

SQL:>cd Employees
SQL:>Dir -filter {where EmployeeId=8}

EmployeeID      : 8
LastName        : Callahan
FirstName       : Laura
Title           : Inside Sales Coordinator
TitleOfCourtesy : Ms.
..."

Nice. I've been thinking about something like this since this post, Provider Explorer in PowerShell Analyzer.

The C# source is also provided.  :)

 

Related Past Post XRef:
Provider Explorer in PowerShell Analyzer

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...