gpt4 book ai didi

sql-server - SQL WHERE 子句中的加号是什么意思 (WHERE + userName = SYSTEM_USER)

转载 作者:行者123 更新时间:2023-12-01 06:19:03 24 4
gpt4 key购买 nike

我一直在努力寻找 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com