Migrating Oracle IN statements

  • Hi,

    I was wondering is there an equivalent in T-SQL to the Oracle syntax that supports the use of multiple columns in the WHERE...IN statement

    WHERE (columnA, columnB) IN (SELECT column1, column2 FROM...)

    David

    If it ain't broke, don't fix it...

  • No, unfortunately SQL Server does not have row constructors. It is one of my top wished for items.

  • Me too,

    I usually either end up concatenating columns to get the required condition, or using WHERE EXISTS.

    Didn't know that the correct name for these was 'row constructors' , thanks for that.

    David

    If it ain't broke, don't fix it...

  • Well don't quote me on it, but I think they are called row constructors in the ANSI-SQL standard. I can check it to confirm when I get home, unless someone else is faster.

  • It would be useful to have this implemented...

             8.4  <in predicate>

             Function

             Specify a quantified comparison.

             Format

             <in predicate> ::=

                  <row value constructor>

                    [ NOT ] IN <in predicate value>

             <in predicate value> ::=

                    <table subquery>

                  | <left paren> <in value list> <right paren>

             <in value list> ::=

                  <value expression> { <comma> <value expression> }...


             7.1  <row value constructor>

             Function

             Specify an ordered set of values to be constructed into a row or

             partial row.

             Format

             <row value constructor> ::=

                    <row value constructor element>

                  | <left paren> <row value constructor list> <right paren>

                  | <row subquery>

             <row value constructor list> ::=

                  <row value constructor element>

                      [ { <comma> <row value constructor element> }... ]

             <row value constructor element> ::=

                    <value expression>

                  | <null specification>

                  | <default specification>

             <null specification> ::=

                  NULL

             <default specification> ::=

                  DEFAULT

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply