PowerShell - sorting files by datestamp for SQL backup/restore

# Do-SPSQLbackupRestore.ps1# usage:# DO-SQLBackupRestore <Backup|Restore> [<SQL instance>] [<XMLfilename]>#[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SMO”) | Out-Null[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SmoExtended”) | Out-Null[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.ConnectionInfo”) | Out-Null[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SmoEnum”) | Out-Null Function DO-SQLBackupRestore {  param ([string] $strSQLaction=”Backup”, [string] $strSQLServerInstance=”(local)”, [string] $DataBasesXML=”C:\BKP\BKP-SQLdatabases.xml”)   $SQLserver = New-Object (“Microsoft.SqlServer.Management.Smo.Server”) $strSQLServerInstance  $xml = [XML] (get-content $DataBasesXML)   ## dbName_yyyyMMddHHmmss.BAK  $stamp = “yyyyMMddHHmmss”  if ($strSQLaction.ToUpper() -eq “BACKUP”) {  DoBackupSQL $SQLserver $xml }  else { if…

3

SQL - dammit it's in there somewhere!

# I wanted to find ALL references to a particular string (domain\user) and I had no idea WHERE it might be.# so how do you ask SQL to go look everywhere and report back?# like this… DECLARE @searchValue varchar(100)SET @searchValue = ‘domain\username’SELECT  ‘select ”’ +  table_schema +  ‘.’ + TABLE_NAME +  ‘.’ + COLUMN_NAME +  ”’ from ‘…

0