sqlserver
---清心寡欲---
这个作者很懒,什么都没留下…
展开
-
SQL Server 游标循环表数据
实现功能,利用游标循环表数据,并打印出来表数据内容实现的思路实现代码: declare @id nvarchar(200) declare @name nvarchar(150) declare @parentid nvarchar(200) declare data cursor for select id,name,parentid from sys_org open data fetch next from data into @id, @..原创 2021-11-30 14:54:46 · 1013 阅读 · 0 评论 -
SQL Server 递归查询上下级
表结构如下:CREATE TABLE [dbo].[sys_org]( [id] [nvarchar](50) NOT NULL, [name] [nvarchar](100) NULL, [parentid] [nvarchar](50) NULL, CONSTRAINT [PK_sys_org] PRIMARY KEY CLUSTERED ( [id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DU原创 2021-11-30 11:05:08 · 6214 阅读 · 1 评论 -
SQLServer 查询数据库死锁
SELECT der.session_id, der.start_time, datediff(ms,der.start_time,getdate()) as ms, der.cpu_time as cputime, der.logical_reads, dest.[text] AS 'sqlcmd', der.* FROM sys.[dm_exec_requests] AS der CROSS APPLY ...原创 2021-08-20 18:14:09 · 298 阅读 · 0 评论