Saturday, December 6, 2008

using posh to get-sqldata

 Accessing SQL Server Data from PowerShell, Part 1

Accessing SQL Server Data from PowerShell, Part 2 Use ADO.NET to insert, update, and delete data



Parse SQL DataSet to variables in Windows Powershell - scrool 2 end 

Getting Powershell output into a sql table in Windows Powershell  

PowerShell Mini SQL Query Analyzer


how to connect to a SQL database, query the Employees table of the Northwind database, and write those results to the screen.  


Using Powershell to Generate Table-Creation Scripts

Create Your First SQL Server Database in 3 Quick Steps

Accessing SQL Server Data from PowerShell, Part 1



SQL Server PowerShell Overview
get-data from sql start-sql

Quick and Dirty Software Inventory with PsInfo and PowerShell


 executing SQL queries from Powershell in Windows Powershell 


Check your SQL Server using Windows PowerShell –series

If you install the SQL Server 2008 client software, you get a SQL Server
PowerShell snap-in. You can run the sqlps.exe utility that loads the snapin
into a PowerShell environment, or start PowerShell and load in the snap-in
yourself. With the snap-in, you can get a list of the instances on a
computer by:

cd SQLSERVER:\SQL\MyComputerName
dir

Running SQL Server PowerShell:
http://msdn.microsoft.com/en-us/library/cc281954.aspx
Using the SQL Server PowerShell Provider:
http://msdn.microsoft.com/en-us/library/cc281947.aspx

NOTE: the Running SQL Server PowerShell topic still uses the old names for
the snap-in. The next update to Books Online includes an update to the topic
that uses the released names: SqlServerProviderSnapin100 and
SqlServerCmdletSnapin100.
-- 



poshOUT-2-sqlIN 


parse results - scroll 2 end

1 comment:

Unknown said...

The examples provided use ADO.NET which requires creating a DataSet, then creating a DataAdapter, and finally filling the DataAdapter. This can be little cumbersome when all you want to do is execute query and return the results as a DataTable. Two eaiser methods are to use SMO or the SQL Server 2008 cmdlet Invoke-SqlCmd. In addition using Data.SqlClient.SqlBulkCopy is probably the easiest way to load data from Powershell into SQL Server. Here are two articles which describe various methods:

http://www.sqlservercentral.com/articles/powershell/65324/

http://www.sqlservercentral.com/articles/powershell/65196/