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

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Get-DbaDatabaseView

Gets database views.

Screenshots

dbatools-Get-DbaDatabaseView

Examples

Gets all database views.

Get-DbaDatabaseView -SqlInstance sql2016

Gets the views for the db1 database.

Get-DbaDatabaseView -SqlInstance Server1 -Database db1
Gets the views for all databases except db1.
Get-DbaDatabaseView -SqlInstance Server1 -ExcludeDatabase db1

Gets the views for all databases that are not system objects (there can be 400+ system views in each DB).

Get-DbaDatabaseView -SqlInstance Server1 -ExcludeSystemView

Gets the views for the databases on Sql1 and Sql2/sqlexpress.

‘Sql1′,’Sql2/sqlexpress’ | Get-DbaDatabaseView

Author

This command was created by Klaas Vandenberghe. You can find Klaas on Twitter.

Get-Help

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

Source Code

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

Related commands