dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Get-DbaTable

Shows table information around table row and data sizes and if it has any table type information.

Screenshots

Examples

To return all tables in the Test1 database.

Get-DbaTable -SqlInstance DEV01 -Database Test1

To return only information on the table MyTable from the database MyDB.

Get-DbaTable -SqlInstance DEV01 -Database MyDB -Table MyTable

To return information on table called MyTable if it exists in any database on the server, under any schema

Get-DbaTable -SqlInstance DEV01 -Table MyTable

To return information on the CommandLog table in the DBA database on both instances localhost and the named instance localhost\namedinstance.

‘localhost’,’localhost\namedinstance’ | Get-DbaTable -Database DBA -Table Commandlog

Author

This command was created by Stephen Bennett. You can find Stephen blogging at sqlnotesfromtheunderground.wordpress.com.

Get-Help

From PowerShell, execute Get-Help Get-DbaTable -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaTable.ps1 on GitHub
 

Related commands