Upgrading compatibility level is not backwards compatible?

  • Hi,

    recently i changed the compatibility level of my database from 80 to 90. This broke one of my stored procedures. Changing it a little bit made it ok again.

    But what worries me, is that their could be more of these breaking changes, is there a list somwhere of the differences of those compatibility levels?

    This was the query (parts of it):

    ....

    SELECT distinct top 100 m.matnr,isnull(pr.price,0) as price,m.oemcode,m.prodcd,m.materialgroup,m.eurocode,m.img_exists, p.description,isnull(s.rankcode,9999) as rankcode,

    ...

    order by S.rankcode, p.description, m.matnr

    ...

    Removing the S. in s.rankcode made it work. I understand why. But i don't understand why it worked in an older compatibility level. (removing the DISTICT made it work also, but with a different result->also strange behaviour)

    Thanks for tour time.

  • While you change the compatibility level of my database from 80 to 90. It's always good to test each and every Stored procedures, function, triggers, Buisness rules etc. in your test environment.

    Also it's quite obvious that after the comopatibility level change your some of the SP may not work hence Microsoft also recommend to test it in test environment thoroughly.

    HTH

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • In 80 compatibility when you have alias for derived column that is same as column name, the prefix is ignored in the order by statement and the order is done on the derived column. In 90 it is not ignored and the order is done on the table column first

    Check out "Alter Database Compatibility Level" in BOL. It has differences between 80, 90 and 100.

  • maybe Upgrade Advisor tool would have caught that ? Not sure

  • we had something similar during testing

    devs had queries that said

    select column1, column1, column3 from sometable order by column1

    worked in 80 but not in 90

  • It is actually expected to have different behaviors when changing compatibility levels!

    It is all well documented HERE


    * Noel

  • p.description,isnull(s.rankcode,9999) as rankcode,

    ...

    order by S.rankcode, p.description, m.matnr

    ...

    Removing the S. in s.rankcode made it work. I understand why. But i don't understand why it

    I would suspect the collation in stead of the dblevel.

    I notice you've used a capital S and a non-capital s to be used as the columns alias.

    Replace the s.rankcode to S.rankcode, and give a little feedback if that has been the issue.

    If you would have posted the from-part, that plausibility might be confirmed.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • THANKS for your time, the correct answer came from noeld : he gave a link to a list with the differences between the compatibility levels.

    (it was not because of the different capitalization, i just wrote that to put the attention on the S.)

  • Thank you for the feedback.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 9 posts - 1 through 8 (of 8 total)

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