What’s the point?

The global environmental situation is getting worse every day.

Some people are worried about it, some others do not really care about it.

Nonsense

What’s the point of trying to reduce our energy consumption while a dozen of ships pollute as much as all cars?

What’s the point of having governments who focus on economic growth and (almost) do not care about ecology?

Continue reading

SQL Server: List active queries

Here is a SQL query that will list the active queries running in the current MS SQL Server instance.

select
    P.spid
,   right(convert(varchar, 
            dateadd(ms, datediff(ms, P.last_batch, getdate()), '1900-01-01'), 
            121), 12) as 'batch_duration'
,   P.program_name
,   P.hostname
,   P.loginame
from master.dbo.sysprocesses P
where P.spid > 50
and      P.status not in ('background', 'sleeping')
and      P.cmd not in ('AWAITING COMMAND'
                    ,'MIRROR HANDLER'
                    ,'LAZY WRITER'
                    ,'CHECKPOINT SLEEP'
                    ,'RA MANAGER')
order by batch_duration desc