SQL Server: Run A Very Large Script By Splitting It Into Pieces Using PowerShell

Everyday is an interesting day in the life of a DBA. Today, I received a request to run in a HUGE script. This script had 125k INSERT statements each in a separate line. Just opening the script was an issue, leave alone running it into a database. You get this error in SSMS just trying … Continue reading SQL Server: Run A Very Large Script By Splitting It Into Pieces Using PowerShell

SQL Server: Visualize Your Backups For Insights – By Month Day, Time etc.

Backups are a very important part of a DBA's job. Understanding when they have happened and when they have not happened is even more important. Quantifying things quickly can mean the difference between good and bad decisions when you are in a bind. Note: If you are looking to do something similar with Oracle, please … Continue reading SQL Server: Visualize Your Backups For Insights – By Month Day, Time etc.

PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria

Update April 19, 2019: Thanks to Tim (in comments), the updated script can also do find/replace in not just stored procedures but also views, UDF's and triggers. Today, a need came-up where a bunch of stored procedures had to be altered based on certain criteria. Easy way: Obviously, the easiest way would be to script … Continue reading PowerShell: Find & Replace SQL Server Stored Procedure/View/UDF/Trigger Code En Masse Based On Custom Criteria