作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在努力寻找 where 子句中加号的含义。有人对此有任何想法吗?被困在上面了。查询本身非常简单,无论是否使用加号,其工作方式都类似。我想删除它,除非它存在是有原因的。
SELECT userID from tblUser WHERE + userName = SYSTEM_USER
添加说明:这是在 SQL Server 2008 中而不是 Oracle 中,也不是来自 Oracle 迁移...如下所述,Oracle 有一个较旧的连接符号,它通常使用某些条件后缀的 +。
最佳答案
一元 +
运算符只是一个空操作。此运算符的文档中对此进行了解释,即 here :
Although a unary plus can appear before any numeric expression, it performs no operation on the value returned from the expression. Specifically, it will not return the positive value of a negative expression. To return positive value of a negative expression, use the ABS function.
我实际上认为这句话有点误导。我认为一元加运算符会将字符串参数转换为数字。当应用于充满数字的常量字符串时,作为鼓励编译器在数字字段上使用索引的一种方式,这实际上可能是有益的。
关于sql-server - SQL WHERE 子句中的加号是什么意思 (WHERE + userName = SYSTEM_USER),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23353076/
我是一名优秀的程序员,十分优秀!