Handy DB Scripts – Rename w/Powershell

Powershell has become a nice toolbox addition to a must-have for, say, Azure. Here’s a slick way to rename files either one or in bulk. Lee Open Powershell #1: Windows Powershell ISE l Open Powershell #2: command prompt Command: Get-ChildItem -Filter "*string to replace*" -Recurse | Rename-Item -NewName {$_.name -replace 'string to replace','new str' } … Continue reading Handy DB Scripts – Rename w/Powershell

Handy DB Scripts – Fix Orphaned SQL Logins

Another script that’s nice to have around is a fix orphaned login script. I use this in particular when restoring databases from one server to another, and you simply receive a login fails error. Today, SSRS was trying to use an orphaned login and got: · An error has occurred during report processing. (rsProcessingAborted) · … Continue reading Handy DB Scripts – Fix Orphaned SQL Logins

Handy DB Scripts – Last Database Restore Date

I need to start collecting scripts someday…I’ve been saying that forever, but haven’t started yet. Maybe it’s time now, and this script is a good one to keep around. This one is to find the last database restore date, and it looks something like: WITH LastRestore AS ( SELECT      [name] AS DatabaseName     ,[create_date] … Continue reading Handy DB Scripts – Last Database Restore Date