|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Friday, September 09, 2011 8:51 AM
Points: 291,
Visits: 389
|
|
| Comments posted to this topic are about the item T-SQL
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 6:30 PM
Points: 18,733,
Visits: 12,330
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 9:20 AM
Points: 1,231,
Visits: 1,391
|
|
This help page lists the logical operators (http://msdn.microsoft.com/en-us/library/ms189773(SQL.90).aspx) including IN.
I don't doubt that an entire clause containing IN is a predicate, but perhaps IN is the operator in the predicate.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, March 27, 2013 9:02 AM
Points: 1,046,
Visits: 573
|
|
Also thaught that a logical operator is correct but a lil explanation will be more apreciated from this side.
What you don't know won't hurt you but what you know will make you plan to know better
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Yesterday @ 1:09 AM
Points: 584,
Visits: 852
|
|
BOL says that IN is a logical operator. Can you please explain why you considered it as a Predicate? Since most of us answered it "wrong", I think we deserved an explanation, right?
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, April 23, 2013 3:29 PM
Points: 73,
Visits: 520
|
|
brdudley (1/7/2010) This help page lists the logical operators (http://msdn.microsoft.com/en-us/library/ms189773(SQL.90).aspx) including IN.
I don't doubt that an entire clause containing IN is a predicate, but perhaps IN is the operator in the predicate.
I agree - IN is technically the logical operator that exists within an expression, which then creates a predicate.
IN by itself certainly does not return anything at all - neither TRUE, nor FALSE, nor UNKNOWN - it would be a syntax error if that was used on it's own.
<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 ) }
Source: http://msdn.microsoft.com/en-us/library/ms173545%28SQL.90%29.aspx
--Chris Hamam Life's a beach, then you DIE (Do It Eternally)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 3:36 AM
Points: 2,522,
Visits: 3,616
|
|
I agree that the given answer is wrong. IN is an operator but can be used in an expression like "a IN (1,2,3)". The expression in this case is a predicate, and IN is the operator used in the predicate.
Best Regards,
Chris Büttner
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: 2 days ago @ 1:49 AM
Points: 3,123,
Visits: 4,310
|
|
Agree with previous posts. IN, like all logical operators, must form part of an expression. A predicate may comprise one or more logical operators (albeit in a join or where)
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Friday, November 09, 2012 7:25 AM
Points: 298,
Visits: 107
|
|
I agree with the previous posts. A little more justification for the answer please. Also, I'm sure that I've seen my execution plans change
WHERE colA IN(1) into WHERE colA=1
and WHERE colA IN(1,2,3) into WHERE colA=1 OR colA=2 OR colA=3
Though to be honest, I can't replicate that right now. I might have seen it running a trace at some point.
It does highlight how SQL tests a value in 2 columns though:
WHERE 1 in(colA,colB) turns into WHERE 1=colA OR 1=colB
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, February 13, 2013 7:13 AM
Points: 256,
Visits: 223
|
|
Agree with Christian Buettner ... IN is the operator used in the predicate.
|
|
|
|