mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-15 23:28:07 +02:00
Update the manuals in Docs/
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
## The list-sql-tables.ps1 PowerShell Script
|
||||
## The PowerShell Script: list-sql-tables.ps1
|
||||
|
||||
This PowerShell script lists all tables in a SQL server database and exports the list as CSV.
|
||||
Install-Module InvokeQuery
|
||||
@ -58,6 +58,7 @@ Author: Markus Fleschutz | License: CC0
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
## Source Code
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists all tables of a SQL server database
|
||||
@ -84,5 +85,6 @@ $creds = New-Object System.Management.Automation.PSCredential ($username, $secpa
|
||||
$csvfilepath = "$PSScriptRoot\sqlserver_tables.csv"
|
||||
$result = Invoke-SqlServerQuery -Credential $creds -ConnectionTimeout 10000 -Database $database -Server $server -Sql "SELECT TABLE_NAME FROM $database.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'" -CommandTimeout 10000
|
||||
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||
```
|
||||
|
||||
*Generated by convert-ps2md.ps1 using the comment-based help of list-sql-tables.ps1*
|
||||
|
Reference in New Issue
Block a user