January 6, 2010 at 11:09 pm
Thanks for the question
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 7, 2010 at 12:00 am
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.
January 7, 2010 at 12:20 am
Also thaught that a logical operator is correct but a lil explanation will be more apreciated from this side.
January 7, 2010 at 12:39 am
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? 🙂
January 7, 2010 at 1:36 am
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)
January 7, 2010 at 1:37 am
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
January 7, 2010 at 1:52 am
This was removed by the editor as SPAM
January 7, 2010 at 2:41 am
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
January 7, 2010 at 2:44 am
Agree with Christian Buettner ... IN is the operator used in the predicate.
January 7, 2010 at 4:27 am
Answer is : Operator
Predicate Is an expression that evaluates to TRUE, FALSE, or UNKNOWN. Predicates are used in the search condition of WHERE clauses and HAVING clauses, the join conditions of FROM clauses, and other constructs where a Boolean value is required.
IN is the logical operator
Please visit the below one to know all the logical operator
January 7, 2010 at 4:41 am
I answered 'Operator' - And guess what, I got it wrong. :w00t:
I agree with all the above members, 'IN' is an operator.
January 7, 2010 at 5:46 am
Allow me to jump on the bandwagon here and say that 'IN' by itself is a logical operator. 'SomeField IN ( 1, 2, 3 )' would be considered a predicate, but by itself, 'IN' does not evaluate to TRUE, FALSE, or UNKNOWN.
January 7, 2010 at 5:52 am
I'll chime in as well to say that IN is an operator. See BOL for list of Logical Operators
http://msdn.microsoft.com/en-us/library/ms189773(SQL.90).aspx
January 7, 2010 at 6:30 am
I can understand the confusion with this question since msdn refers to IN many different ways. A number of msdn links have already been posted to defend different answers and here is another one.
http://msdn.microsoft.com/en-us/library/ms177682.aspx
In the remarks section the first sentence refers to IN as a clause. "...values (many thousands) in an IN clause can..."
Also, the article referenced is specifically for IN (Transact-SQL) not predicates or logical operators.
Dave
Viewing 15 posts - 1 through 15 (of 47 total)
You must be logged in to reply to this topic. Login to reply