Created
April 21, 2020 20:02
-
-
Save aadennis/0d700c0678c793c2a8a2fa63b7aaf2d7 to your computer and use it in GitHub Desktop.
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
# Show the content of a set of tables on a given database | |
function Get-TableSet($database, $tableSet) { | |
$tableSet | ForEach-Object { | |
$table = $_ | |
$query = "select '$table' as [Table-$table], * from [$database].[dbo].[$table] " | |
Write-Host "Running [$query]." | |
Invoke-Sqlcmd -ServerInstance localhost -U sa -P TheDemo -Query $query -Verbose | | |
Out-GridView -Title "$database.$table " | |
} | |
} | |
$database = "aa_somedb" | |
$tableset = "things","things2" | |
Get-TableSet $database $tableset | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment