SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Upgrading compatibility level is not backwards compatible?


Upgrading compatibility level is not backwards compatible?

Author
Message
ojooris
ojooris
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 8
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.
free_mascot
free_mascot
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4803 Visits: 2248
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."
JamieX
JamieX
SSChasing Mays
SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)SSChasing Mays (657 reputation)

Group: General Forum Members
Points: 657 Visits: 437
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.
homebrew01
homebrew01
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6339 Visits: 9177
maybe Upgrade Advisor tool would have caught that ? Not sure



alen teplitsky
alen teplitsky
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3674 Visits: 4674
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
noeld
noeld
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12486 Visits: 2048
It is actually expected to have different behaviors when changing compatibility levels!
It is all well documented HERE


* Noel
ALZDBA
ALZDBA
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15942 Visits: 8971
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


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


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


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
ojooris
ojooris
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 8
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.)
ALZDBA
ALZDBA
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15942 Visits: 8971
Thank you for the feedback.

Johan


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


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


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

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


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search