Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mssql get running queries

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
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql show data from table 
Sql :: sql server for loop 
Sql :: SELECT LOCKED FROM public.databasechangeloglock WHERE ID=1 
Sql :: sql primary key with multiple columns 
Sql :: sql update query 
Sql :: change month to name in sql server 
Sql :: truncate left characters mysql 
Sql :: alter table drop column 
Sql :: mysql bigint max value 
Sql :: laravel paginate raw sql 
Sql :: apex add months to date 
Sql :: sqlserver create table from select 
Sql :: add postgresql to path 
Sql :: mysql reset auto increment to 1 
Sql :: sqlite version check 
Sql :: get first 2 letter in sql 
Sql :: sql query to find duplicate email address 
Sql :: PL SQL MODIFY COLUMN NME 
Sql :: sql alchemy with azuresql server 
Sql :: oracle list privileges 
Sql :: reset identity column values in sql server 
Sql :: where to locate set password for mysql 
Sql :: sQL query to get all table records count from a database 
Sql :: update all rows mysql 
Sql :: how to alter length character varying postgres 
Sql :: mssql how to insert more than 1000 rows 
Sql :: delete a record from a table sqlite3 
Sql :: find tables with column name in sql 
Sql :: sql group by year 
Sql :: postgresql how to show table names 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =