不应该像:
WHERE 1=2 and 2=3, 1=1
可以使用这种语法吗?
https://msdn.microsoft.com/en-us/library/ms173545.aspx
<search_condition> ::=
{ [ NOT ] <predicate> | ( <search_condition> ) }
[ { AND | OR } [ NOT ] { <predicate> | ( <search_condition> ) } ]
[ ,...n ]
<predicate> ::=
{ expression { = | < > | ! = | > | > = | ! > | < | < = | ! < } expression
| string_expression [ NOT ] LIKE string_expression
[ ESCAPE 'escape_character' ]
| expression [ NOT ] BETWEEN expression AND expression
| expression IS [ NOT ] NULL
| CONTAINS
( { column | * } , '<contains_search_condition>' )
| FREETEXT ( { column | * } , 'freetext_string' )
| expression [ NOT ] IN ( subquery | expression [ ,...n ] )
| expression { = | < > | ! = | > | > = | ! > | < | < = | ! < }
{ ALL | SOME | ANY} ( subquery )
| EXISTS ( subquery ) }
编辑:
此WHERE 1=2 and 2=3, 1=1
应该是WHERE 1=2 and 2=3, and 1=1
。
谢谢lad2025的图表。
答案 0 :(得分:2)
不,这是不允许的。请参阅人类可读的图表:
搜索条件
<强> [,... n]的强>
表示前面的项目可以重复n次。该 事件以逗号分隔。
[... n]
表示前面的项目可以重复n次。该 事件由空白分隔。
在我看来应该有[...n]
,不允许使用逗号:
SELECT '1' AS val
WHERE 1=2 AND 2=2,AND 3=3
产生
','附近的语法不正确。