MSSQL Query Blog

Listing Last Three Months in SQL Server

Hello to everyone, In this article, I will try to give information about listing the last three months in SQL Server. In SQL Server you may want to list the last three months in some cases. You can easily do this using the code below. WITH R (N) AS (SELECT...

Monitoring Blocking in SQL Server

Hello to everyone, In this article, I will try to give information about monitoring blocking in SQL Server. You may want to watch blocking and waits in SQL Server in some cases. You can easily do this using the code below. SET NOCOUNT ON; GO SELECT spid, blocked, REPLACE(REPLACE(T.text, CHAR(10),...

Differences Between Cross Apply and Outer Apply in SQL Server

Hello to everyone, In this article, I will talk about the differences between Cross Apply and Outer Apply in SQL Server. In SQL Server, such questions may come up as an interview question in recruitment as a database specialist. Similar to using CROSS APPLY -> INNER JOIN. Considers the intersection...

Rebuilding and Compiling All Views in SQL Server

Hello to everyone, In this article, I will try to give information about rebuilding and compiling all Views in SQL Server. In SQL Server you may want to rebuild and compile all Views in some cases. You can easily do this using the code below. DECLARE @SQL VARCHAR(MAX) = ”;...

Don`t copy text!