摘要: 这个是完全copy 宋大侠的文章,他的文章都是经典,绝对是学习的佳品。 简介: SQL SERVER2012实现了类似C#抛出异常的Throw语句。相比较于SQL Server2005之前使用@@ERROR,和SQL Server2005之后使用RAISERROR()引发异常都是一个不小的进步,下面 阅读全文
posted @ 2019-01-27 21:29 秋天的林子 阅读(746) 评论(0) 推荐(0)
摘要: 下面我会比较 EXCEPT/INTERSECT跟 not in/in的区别,其实最主要的区别就是EXCEPT/INTERSECT可以去重,相当于 not in/in加了distinct关键字,这点类似于union和union all 1、创建测试数据: 2、单列和所有列比对 3、跟NOT IN比较: 阅读全文
posted @ 2019-01-22 13:15 秋天的林子 阅读(2475) 评论(0) 推荐(0)
摘要: 近期,我在切AlwaysOn的时候出现了下面这个报错,最后通过MSDN解决了 阅读全文
posted @ 2019-01-08 10:40 秋天的林子 阅读(363) 评论(0) 推荐(0)
摘要: 前言: 该文并不全是本人原创,里面的某些原理来自于CareySon。 SQL SERVER数据存储的形式 要理解逻辑读、物理读、预读这三个概念,先要搞懂SQL Server的数据存储方式。 SQL Server数据库包括数据文件和日志文件,一个数据库可以有一个或多少数据文件、日志文件。所有的数据存储 阅读全文
posted @ 2019-01-03 08:48 秋天的林子 阅读(389) 评论(1) 推荐(0)
摘要: Compares a scalar value with a single-column set of values. SOME and ANY are equivalent. Here is the example: it will return "TRUE", because 3 less th 阅读全文
posted @ 2018-12-25 08:25 秋天的林子 阅读(133) 评论(0) 推荐(0)
摘要: The following explanation from MSDN LEAD provides access to a row at a given physical offset that follows the current row. Use this analytic function 阅读全文
posted @ 2018-12-24 15:54 秋天的林子 阅读(367) 评论(0) 推荐(0)
摘要: As the name suggests: table-valued returns table, however Scalar-valued returns a single value, such as a string, integer, or bit value. 1、table-value 阅读全文
posted @ 2018-12-21 10:03 秋天的林子 阅读(485) 评论(0) 推荐(0)
摘要: You also can read the Chinese version: 秋天的林子 SQLSERVER的阻塞和死锁 Sys.SysProcesses: it's a important system view, it can locate and resolve block and deadl 阅读全文
posted @ 2018-12-20 09:08 秋天的林子 阅读(924) 评论(0) 推荐(0)
摘要: Sys.SysProcesses 系统表是一个很重要的系统视图,主要用来定位与解决Sql Server的阻塞和死锁 视图中主要的字段: 1. Spid:Sql Servr 会话ID 2. Kpid:Windows 线程ID 3. Blocked:正在阻塞求情的会话 ID。如果此列为 Null,则标识 阅读全文
posted @ 2018-12-20 08:27 秋天的林子 阅读(1628) 评论(0) 推荐(0)
摘要: ENCRYPTBYASYMKEY() --非对称密钥 ENCRYPTBYCERT() --证书加密 ENCRYPTBYKEY() --对称密钥 ENCRYPTBYPASSPHRASE() --通行短语(PassPhrase)加密 --非对称密钥包含数据库级的内部公钥和私钥,它可以用来加密和解密SQL 阅读全文
posted @ 2018-12-18 08:36 秋天的林子 阅读(4092) 评论(0) 推荐(0)