Last active
January 24, 2019 17:52
-
-
Save nvarscar/25eed474b0351a6683e1f0b2bf50482b to your computer and use it in GitHub Desktop.
Examples for Invoke-DBOQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get current database from a PostgreSQL server | |
Invoke-DBOQuery -Type PostgreSQL -Server localhost:5432 -Database postgres -Query 'SELECT current_database()' -As SingleValue | |
# Run a query against MySQL database | |
Invoke-DBOQuery -Type MySQL -Server localhost -Database mysql -Query 'SELECT Name from Users' | |
# Run multiple files from a folder in a specific SQL Server database | |
Get-ChildItem .\Scripts | Invoke-DBOQuery -SqlInstance 'SqlServer1:1443' -Database MyDB | |
# Connect to an Oracle database interactively as SYSDBA | |
Invoke-DBOQuery -Type Oracle -SqlInstance localhost -Interactive -Username sys -Password $mySecurePassword -ConnectionAttribute @{ 'DBA Privilege' = 'SYSDBA' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment