-
Notifications
You must be signed in to change notification settings - Fork 32
Invoke SqlScalar
mithrandyr edited this page Mar 22, 2018
·
2 revisions
Executes a Scalar query.
Executes a Scalar query against the targeted connection. If the sql statement generates multiple rows and/or columns, only the first column of the first row is returned.
Mandatory = YES|NO|<default value>
Name | Type | Mandatory | Description |
---|---|---|---|
ConnectionName | String | "default" | User defined name for the connection |
Query | String | "default" | SQL statement to run. |
Parameters | Hashtable | Parameters required by the query. Key matches the parameter name, value is the value of the parameter. | |
CommandTimeout | Integer | -1 | The timeout, in seconds, for this SQL statement, defaults (-1) to the command timeout for the SqlConnection. |
Invoke-SqlScalar -Query "SELECT Count(1) FROM TABLE"
Invoke-SqlQuery -Query "SELECT Count(1) FROM TABLE WHERE colb > @someDate" -Parameters @{someDate = (Get-Date)}