随笔分类 - sql
摘要:begin tran begin 执行SQL开始 update Audioset Name =3 执行SQL结束 if @@ROWCOUNT>1 begin rollback end else begin commit end end
阅读全文
摘要://效率,dapper add list 8000条 40秒,它只要1秒多 public static int SqlBulkCopy<T>(this DbConnection conn, List<T> list) where T : Key { var type = typeof(T); var
阅读全文
摘要:select spIdfrom master..SysProcesseswhere db_Name(dbID) = 'Tb_axxxxx'and spId <> @@SpIdand dbID <> 0 --先查后解除 declare @spid intSet @spid = 149 --锁表进程de
阅读全文
摘要:with a as( select * from( select 1 userId , '天津' province union select 1 userId , '北京' union select 1 userId , '上海' union select 2 userId , '北京' union
阅读全文
摘要:with tt as( select 'A' product, 100 price, '2021第1季度' time union all select 'A' product, 777 price, '2021第1季度' time union all select 'A' product, 111
阅读全文
摘要:USE 数据库goEXEC dbo.sp_changedbowner N'账号'
阅读全文
摘要:CREATE trigger 触发器名 on 表名 for update,delete as set nocount on create table #t(EvebtType varchar(60),Parameters int,EventInfo varchar(2000)) declare @i
阅读全文