上一页 1 2 3 4 5 6 ··· 17 下一页
摘要: select Age1 from Student where Name = '张三' create nonclustered index Tw on Student(Name) include(Age1) 创建索引时,可以加上这个 include(Age1) 阅读全文
posted @ 2022-07-23 09:46 艾特-天空之海 阅读(10) 评论(0) 推荐(0) 编辑
摘要: option (recompile)使用在语句 select * from Student where id =1 option (recompile) 使用在存储过程 create proc proc_test (@i int) with recompile as select * from St 阅读全文
posted @ 2022-07-23 08:56 艾特-天空之海 阅读(20) 评论(0) 推荐(0) 编辑
摘要: exec 是解决存储过程parameter sniffer 的方式之一; 用法例子: Declare @sql varchar(1000); set @sql = 'select * from Student'; exec (@sql); 阅读全文
posted @ 2022-07-23 08:26 艾特-天空之海 阅读(100) 评论(0) 推荐(0) 编辑
摘要: --使用缓存 exec sp_executesql N'select * from consume where DATE = @t', N'@t DateTime', '2018-12-04 00:00:00.000' 阅读全文
posted @ 2022-07-19 06:54 艾特-天空之海 阅读(21) 评论(0) 推荐(0) 编辑
摘要: SET XACT_ABORT ON 当 SET XACT_ABORT 为 ON 时,如果 Transact-SQL 语句产生运行时错误,整个事务将终止并回滚 SET XACT_ABORT ON BEGIN TRAN --要执行的语句 COMMIT TRAN GO 参考来源: https://blog 阅读全文
posted @ 2022-07-13 07:13 艾特-天空之海 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 行版本控制: 1、READ_COMMITTED_SNAPSHOP 已提交读隔离 2、SNAPSHOT 缺点:由于读取的是副本的数据,会有造成逻辑错误的风险; 阅读全文
posted @ 2022-07-10 16:15 艾特-天空之海 阅读(24) 评论(0) 推荐(0) 编辑
摘要: set statistics profile on select * from Books 进行set statistics profile on 设置后 将会返回执行计划表,通过该表,可以理解语句执行的过程,了解SQL Server是否选择了正确的执行计划,进而确定调优方向! 1、返回表字段描述: 阅读全文
posted @ 2022-07-10 15:11 艾特-天空之海 阅读(86) 评论(0) 推荐(0) 编辑
摘要: git add doc/who.sql “doc/who.sql”是指定文件夹下的文件; 阅读全文
posted @ 2022-07-10 09:07 艾特-天空之海 阅读(271) 评论(0) 推荐(0) 编辑
摘要: --返回某个用户的进程信息 exec sp_who2 'sa' --返回活动的进程信息 exec sp_who 'ACTIVE' --返回指定进程ID的信息 exec sp_who2 '1' 阅读全文
posted @ 2022-07-10 08:44 艾特-天空之海 阅读(10) 评论(0) 推荐(0) 编辑
摘要: if object_id(N'fm_jx_contract',N'U') is not null begin select 1 end 阅读全文
posted @ 2022-07-01 11:45 艾特-天空之海 阅读(6) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 17 下一页