Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created March 15, 2018 22:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save shaneis/069d330a19d737fd21190bec071a49c4 to your computer and use it in GitHub Desktop.
Script to show how to get a row count for tables in a SQL Server database.
$DatabaseParam = @{
SqlInstance = 'localhost\SQLDEV2K14'
Database = 'DMODisabled'
}
Get-DbaDatabase @DatabaseParam |
Select-Object -ExpandProperty Tables |
ForEach-Object -Process {
[PSCustomObject]@{
Name = $_.Name
RowCount = $_.RowCount
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment