Last active
May 18, 2018 02:51
-
-
Save alevyinroc/9dc3f8474341f83510f991250589c20f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module dbatools,importexcel; | |
$DBServer = 'MYSERVER'; | |
$TableList = Get-Content TableList.txt; | |
$Tables = Get-DbaTable -ServerInstance $DBServer -Database Satellites -Table $TableList; | |
foreach ($Table in $Tables) { | |
$Columns = $Table.columns | Select-Object Name,DataType,Nullable,@{name='Length';expression={$_.Properties["Length"].Value}}; | |
$Columns | Export-Excel -Path C:\Users\andy\Documents\TableInfo.xlsx -WorkSheetname $Table.Name -FreezeTopRow -BoldTopRow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment