SQL Server 查询数据库死锁语句与表字段创建时间

-- 查询死锁
select
	request_session_id spid,
	OBJECT_NAME(resource_associated_entity_id) tableName
from
	sys.dm_tran_locks
where
	resource_type='OBJECT'
order by spid

-- 查询表字段创建与修改时间
SELECT c.name        AS '列名',
       t.name        AS '数据类型',
       c.max_length  AS '最大长度',
       c.is_nullable AS '是否允许为空',
       t.create_date AS '创建时间',
       t.modify_date AS '修改时间'
FROM sys.columns c
	     JOIN sys.tables t ON c.object_id = t.object_id
WHERE t.name = 'table_name'
posted @ 2022-03-14 16:15  Incercadi  阅读(1153)  评论(0编辑  收藏  举报