• Hugo Kornelis (6/12/2012)


    Thanks for the question, Ron. And thanks Koen for the extra link.

    In case someone is wondering why the different data types have no effect - Ron included the relevant link, but didn't explicitly describe this in his explanation, so I will. The data types are compared to find the one with the highest precedence. It's char(2) vs bigint, so if you check Ron's link, you'll see that bigint wins. SQL Server then checks to see if implicit conversion is allowed for char to biging; this is the case, so the query compiles and a plan is created. During execution time, all char(2) values are converted to bigint, and then the INTERSECT operation is carried out.

    If you change one of the values in the char(2) column to be something that doesn't convert to biging (e.g. 'a'), you'll get a run-time error.

    Thanks for the additional explanation which you have explaned in a clear simple manner something one does not often find in BOL ... I am sure it will be appreciated by all those who read your posting.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]