Powershell to Automate Reindexing on Azure SQL DB

I was working on Azure SQL DB and got the task of running reindexing over several Azure SQL DB… I thought of why not automating it instead of running the script over the Azure SQL dbs one by one …

PowerShell to export data from a SQL Server table to csv in chunk of 15 days

A client had a table which was storing data since 11 years, and he wanted to export all that data into csv files in a chunk of 15 days data per csv file. So I developed a PowerShell script to do the same. Hope it helps in different scenarios.

TSQL to get comprehensive SQL server backup report

Many times while trouble shooting backup issues on SQL server we have to check manually that when was the latest backup taken , where it was taken and for which all databases it happened . This requires a lot of manual clicks and script typing. To ease this , I have developed a script that … Read more

TSQL to get all logins’ permissions

We had a request from one customer where he wanted to have a visual representation of all the logins present in the SQL instance and the kind of server lever and database level permissions they have in one result set. I searched the net for solutions but could either find a script that gave either … Read more

PowerShell Script to get\download latest SQL backup file from S3 bucket

Introduction: In today’s data-driven world, businesses rely heavily on robust database management systems to ensure the integrity and availability of their valuable information. As part of this process, regular backups are crucial to safeguard data against unforeseen events. Recently, we received a customer request to download the latest SQL backup file from their S3 bucket. … Read more

T-SQL Script to list foreign key relationships

In this article, we will see T-SQL scripts to list foreign key relationships between tables. What is Referential dependency ? Referential dependency is a constraint between two tables in a relational database that ensures data consistency. To establish a referential dependency, you define a foreign key on a table that refers to the primary key … Read more

How to run a script on all databases that are either AG primary or standalone in SQL instance

In this article we will discuss on how to run a script on all databases that are either AG primary or standalone in SQL instance.

Script to find space utilization in each data file and log file

Script to find space utilization in each data file and log file. This will be useful while troubleshooting data and log file full issues.

Script to find last successful run of SQL agent jobs

Script to find last successful run of SQL agent jobs.