Uncategorized

SQL Server Agent Jobs

Find out which SQL Agent Jobs that are currently running

Find out which SQL Agent Jobs that are currently running If you ever want to find out which SQL Server Agent jobs that are currently running on your server without using Management Studio, just run the code below. SELECT ja.job_id, j.name AS job_name, ja.start_execution_date, ISNULL(last_executed_step_id,0)+1 AS current_executed_step_id, Js.step_name FROM msdb.dbo.sysjobactivity ja LEFT JOIN msdb.dbo.sysjobhistory jh …

Find out which SQL Agent Jobs that are currently running Read More »

how long is it now

Has it finished?

Has it finished? is a question you will ask yourself many times when you are running something within SQL Server. If you are backing up a database, restoring a database or you just want to find out how long a task on your server will take to complete, then just run the code below to …

Has it finished? Read More »

CROSS APPLY vs INNER JOIN vs LEFT JOIN vs OUTER APPLY

JOIN and APPLY

CROSS APPLY vs INNER JOIN vs LEFT JOIN vs OUTER APPLY So you want to improve your SQL skills and have come across some new operators like JOIN and APPLY and are wondering when you should use them. In this blog, I will focus on the following operators in the simplest terms and show you …

JOIN and APPLY Read More »

SQL Server Functions

SQL Server Functions

SQL Server Functions Sometimes you read books on subjects about SQL Server and you just want to learn the basics, well here are the basics of SQL Server Functions Functions can be Scalar or Table-valued Scalar returns one value and Table-valued functions (TVF) returns…well a table of results and this are usually found in the …

SQL Server Functions Read More »