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
/* Return a list columns in the database and for each column a comma delimited list of tables in which that column appears */ | |
SELECT | |
c.name AS ColumnName | |
, STRING_AGG(CONCAT( QUOTENNAME(s.name), '.', QUOTENAME(t.name)), ', ') | |
WITHIN GROUP (ORDER BY CONCAT(QUOTENAME(s.name), '.', QUOTENAME(t.name))) AS TableListForColumn | |
, COUNT(*) AS TableUsageCountForColumn | |
FROM sys.tables AS t | |
JOIN sys.columns AS c ON c.object_id = t.object_id | |
JOIN sys.schemas AS s ON s.schema_id = t.schema_id | |
GROUP BY c.name |
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
#Creates a new password of specified length using characters within the random character set | |
function Get-NewPassword ([int32]$PasswordLength) { | |
if (!$PasswordLength) { $PasswordLength = 42 } | |
[string]$CharacterSet = 'abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ!@#$%^&*()[]{},.<>/?' | |
$RandomChar = 1..$PasswordLength | ForEach-Object { Get-Random -Maximum $CharacterSet.length } | |
$ofs = "" | |
[string]$CharacterSet[$RandomChar] | |
} |
OlderNewer