检查所有表是否有错误

2022年8月11日 开发日志 评论已被关闭

declare @name varchar(100)
declare cur cursor for
select name from sysobjects where xtype=’u’ order by name
open cur
fetch next from cur into @name
while @@fetch_status=0
begin

dbcc checktable(@name)

fetch next from cur into @name
end
close cur
deallocate cur

断开指定数据库连接

2022年8月10日 开发日志 评论已被关闭

use   master
go

if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N'[dbo].[p_killspid]’)   and   OBJECTPROPERTY(id,   N’IsProcedure’)   =   1)
drop   procedure   [dbo].[p_killspid]
GO

create   proc   p_killspid
@dbname   varchar(200) –要关闭进程的数据库名
as
declare   @sql     nvarchar(500)
declare   @spid   nvarchar(20)

declare   #tb   cursor   for
select   spid=cast(spid   as   varchar(20))   from   master..sysprocesses   where   dbid=db_id(@dbname)
open   #tb
fetch   next   from   #tb   into   @spid
while   @@fetch_status=0
begin
exec(‘kill   ‘+@spid)
fetch   next   from   #tb   into   @spid
end
close   #tb
deallocate   #tb
go

–用法

exec   p_killspid     ‘数据库名’

查询当前锁占用

2022年7月27日 开发日志 评论已被关闭

SELECT session_id, start_time, status,
total_elapsed_time,
CASE transaction_isolation_level
WHEN 1 THEN ‘ReadUncomitted’
WHEN 2 THEN ‘ReadCommitted’
WHEN 3 THEN ‘Repeatable’
WHEN 4 THEN ‘Serializable’
WHEN 5 THEN ‘Snapshot’
ELSE ‘Unspecified’ END AS transaction_isolation_level,
sh.text, ph.query_plan
FROM sys.dm_exec_requests
CROSS APPLY sys.dm_exec_sql_text(sql_handle) sh
CROSS APPLY sys.dm_exec_query_plan(plan_handle) ph

解决生成的存储过程,视图是字符串的问题。

2022年6月7日 开发日志 评论已被关闭

查看当前数据库连接情况

2022年5月9日 开发日志 评论已被关闭

datatable linq

2022年5月2日 开发日志 评论已被关闭

sql 断开所有连接

2022年4月20日 开发日志 评论已被关闭

SpaceSniffer 磁盘空间分析工具

2022年4月13日 开发工具 评论已被关闭

does not have a valid constructor. To correctly implement ISerializable a constructor that takes

2022年1月5日 开发日志 评论已被关闭

dpi换算 ZPL

2021年11月13日 开发笔记 评论已被关闭