$databases= ('DB01', 'Bb02')
$destpath = 'C:'Export''
$ServerInstance = 'Servername.database.windows.net'
$UserName = 'Benutzer'
$Password = 'Passwort'
Abrufen aller Tabellen aus Datenbanken
foreach ($database in $databases)
$tables = $null
$query = 'Name aus sys.tabellen auswählen, wobei is_ms_shipped =0'
$tables = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $database -Username $UserName -Password $Password -Query $query
foreach ($table in $tables)
$filepath = $destpath + $database +'-' + 'table.name + '.csv'
$query = 'Select * aus ' + table.name
Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $database -Username $UserName -Password $Password -Query $query | Export-Csv -Pfad $filepath -NoTypeInformation
<code>
} }