Get-SqlData
Executes a query and returns an array of System.Data.DataRow.
Syntax
Get-SqlData [[-sqlserver] <Object>] [-dbname] <Object> [-qry] <String> [<CommonParameters>]
Detailed Description
The Get-SqlData function executes a query and returns an array of System.Data.DataRow.
Related Commands
Parameters
Name |
Description |
Required? |
Pipeline Input |
Default Value |
sqlserver |
|
false |
false |
|
dbname |
|
true |
false |
|
qry |
|
true |
false |
|
Input Type
None
You cannot pipe objects to Get-SqlData
Return Values
System.Data.DataRow
Get-SqlData returns an array of System.Data.DataRow.
Examples
EXAMPLE 1
Get-SqlData "Z002\sql2K8" "pubs" "select * from authors"
This command executes the specified SQL query using Windows authentication.
EXAMPLE 2
$server = Get-SqlServer "Z002\sql2K8" "sa" "Passw0rd"
Get-SqlData $server "pubs" "select * from authors"
This command executes the specified SQL query using SQL authentication.