regex

SQL Query Stats via Powershell

Andy Levy
Sometimes, work tasks and questions that come up in the SQL Server Community Slack coincide. A couple weeks ago, DrData asked With SET STATISTICS IO ON, is there really no way to show the TOTALS at the bottom? There are some nice tools like StatisticsParser but it sure would be nice to see the totals of all values right at the bottom, especially when there are many tables. The task at hand in the office was a need to do the same thing, but with SET STATISTICS TIME ON.

Regular Expressions to Generate Disable/Drop Index Scripts

Andy Levy
Earlier this year, I embarked on a bit of a project to tidy up the indexes in a sizeable database. This database has over 900 tables, and there are quite a few indexes which I have long suspected don’t need to exist for a variety of reasons. Some indexes are redundant, others don’t get used, still others could be combined into a single index. By reducing the number of indexes, we can improve write performance in the database, and the size of the database itself.

Regular Expression Search & Replace in Visual Studio Code

Andy Levy

Kind of a diversion into a Visual Studio Code/Azure Data Studio tip here (this works in both, as well as SQL Server Management Studio). I’m not a regular expression guru - far from it. I use them occasionally, but usually find myself fumbling around for a bit trying to figure out just the right expression to do what I need.

I’ve known for a while that VSCode/ADS had regular expression matching built into its find/replace feature, but did you know you can also replace with it? It can help remove the tedium of doing a large amount of text processing.