🗄️ SQL-Server
(47 posts)
T-SQL queries, performance tuning, security management, and administration guides for Microsoft SQL Server.
📅 2019-08-26
✍️ Bart Schelstraete
In a SQL Always On setup, the SQL agent jobs are not synced between the different nodes. This means you need to manually create them on the other nodes. For read-write jobs, you can only run them on…
Read more →
📅 2019-06-28
✍️ Bart Schelstraete
Is your SQL Always On experiencing a delay? Use the T-SQL code below to find out the performance of SQL Always On. --Check metrics first IF OBJECT_ID('tempdb..#perf') IS NOT NULL DROP TABLE #perf…
Read more →
📅 2019-06-28
✍️ Bart Schelstraete
;WITH UpTime AS ( SELECT DATEDIFF(SECOND,create_date,GETDATE()) [upTime_secs] FROM sys.databases WHERE name = 'tempdb' ), AG_Stats AS ( SELECT AR.replica_server_name, HARS.role_desc,…
Read more →
📅 2019-06-18
✍️ Bart Schelstraete
In SSMS you have the "schema changes history" report. You can get the same (or even more) details from T-SQL. You can use the T-SQL statement below to find schema changes from the last day in a…
Read more →
📅 2019-06-10
✍️ Bart Schelstraete
The T-SQL code below will give you an idea of the memory used by your reporting service. This query should be executed on the "reportserver" database. Please be aware that executing this statement…
Read more →
📅 2019-05-15
✍️ Bart Schelstraete
You can use the T-SQL code below within your database to give permissions to 'MYUSER' for viewing all stored procedures. (Of course, replace "MYUSER" with your own user.) Once executed, you can copy…
Read more →
📅 2019-05-10
✍️ Bart Schelstraete
Running a DBCC CHECKDB can take a lot of time, and in case of corruption you really want to see the progress. You can use the T-SQL statement below to find the progress. Remember to replace…
Read more →
📅 2019-02-11
✍️ Bart Schelstraete
The code below will list the transactions on the instance, and it will also include the size of the log which is used for that transaction. The output is ordered by log size. Select transaction_id,…
Read more →
📅 2019-02-11
✍️ Bart Schelstraete
You can use the default trace in SQL Server in order to track CREATE/DELETE/ALTER DDL operations. The T-SQL code below will show the CREATE/DELETE/ALTER DDL operations visible in the default trace.…
Read more →
📅 2019-02-11
✍️ Bart Schelstraete
Backups/restores can take a lot of time, but while they are running, you want to see the progress. By executing the handy T-SQL code below, you can see the progress of the backups/restores on your…
Read more →