Category Archives: SQL Query

SQL Alwayson Preferred Node workaround, Fallback script

We have Always-On configured between Node-1, Node-2 with Auto Failover enabled. Unfortunately one minor functionality was partially impacted when AG is primary on Node-2. Business is very particular about not changing it to Manual Failover mode. End up creating a … Continue reading

Posted in Script, SQL, SQL Query, Uncategorized | Tagged , , , , | Leave a comment

Availability Group Fail Over date/time – TSQL

I have been using this quick script to verify AG Status Change details from error log.

Posted in High Availability, SQL, SQL Query, SQL Server, Uncategorized | Tagged , , , , , | Leave a comment

Interesting observation with DATETIMEOFFSET data type in SQL

Calculating daily max values of a table will be different if you are using/storing the data in DATETIMEOFFSET format. Basic difference is, while comparing the data between DATETIMEOFFSET and DATE (or DATETIME), DATETIMEOFFSET value will be converted to UTC and … Continue reading

Posted in Script, SQL, SQL Query, Uncategorized | Tagged , , , , | Leave a comment

Azure – All DBs that are not in Elastic pools

Posted in Azure, SQL, SQL Query, Uncategorized | Tagged , , , | Leave a comment

All Databases without geo-replica on Azure Server

Query to find all Azure database without geo-replica configured.

Posted in Azure, SQL, SQL Query, SQL Server, Uncategorized | Tagged , , | Leave a comment

TSQL to find Deadlock count in Azure Server by date

   

Posted in Azure, SQL, SQL Query, Uncategorized | Tagged , , | Leave a comment

TSQL to find users and their access on a given database

TSQL to find users and their access on a given database

Posted in Script, SQL, SQL Query, Uncategorized | Tagged , , , | Leave a comment