declare @dbname nvarchar(200),@objid nvarchar(200)
set @dbname='petty_cash_origin'
set @objid='pc_invoice_master'
select a.req_spid,db_name(a.rsc_dbid) as 資料庫,object_name(a.rsc_objid) as 表,
資源型別=case a.rsc_type when 1 then 'null 資源(未使用)'
when 2 then '資料庫'
when 3 then '檔案'
when 4 then '索引'
when 5 then '表'
when 6 then '頁'
when 7 then '鍵'
when 8 then '擴充套件盤區'
when 9 then 'rid(行 id)'
when 10 then '應用程式'
end,
鎖模式=case a.req_mode when 0 then 'null'
when 1 then 'sch-s(架構性定性)'
when 2 then 'sch-m(架構修改)'
when 3 then 's(共享鎖)'
when 4 then 'u更新'
when 5 then 'x排它鎖'
when 6 then 'is意向共享'
when 7 then ''
end,
鎖狀態=case a.req_status when 1 then '已授權'
when 2 then '正在轉換'
when 3 then '正在等待'
end,
物件型別=case a.req_ownertype when 1 then '事務'
when 2 then '游標'
when 3 then '會話'
endfrom master.dbo.syslockinfo as a,master.dbo.sysprocesses as b
where a.rsc_dbid = b.dbid and a.req_spid = b.spid
and a.rsc_type=5 and object_name(a.rsc_objid)=@objid and db_name(a.rsc_dbid)=@dbname
order by req_spid
需要排序的分頁SQL語句(sqlserver)
真正讓我摒棄top的原因是,我專案中要用到order by進行排序,sqlserver又是乙個在分頁這一塊支援的一般的資料庫,再加上乙個排序,徹底讓我和top說了byebye 那麼需要排序的分頁應該怎麼寫呢?我採用的是row number over函式配合with臨時表進行實現。話不多說,先上 wi...
sql 語句 查詢
例11 1 1 use xk gocreate trigger test1 on student for update as print 記錄已修改!go 2 update student set pwd 11111111 where stuno 00000001 例11 3 1 use xk go...
SQL查詢語句
create or replace procedure imms pk reportsend fromdate varchar2,todate varchar2 as function 系統效能統計 author qja 功能 將imms statusreport 表和imms report sen...